csmith-project / creduce

C-Reduce, a C and C++ program reducer
Other
1.25k stars 123 forks source link

pass_line_markers doesn't check that it still builds after? Should do so and diagnose #217

Closed erichkeane closed 4 years ago

erichkeane commented 4 years ago

I had a case where pass_line_markers (removing the line markers) ended up causing a failure, but it didn't seem to check to make sure it was allowed to do so.

The problem is that there are compilers (such as clang) with warnings-as-default-errors that don't diagnose these warnings in system header files. The process of removing these line markers makes these no longer be in the system header files.

As a result, creduce didn't do anything for an extended period of time.

In my opinion, this pass should do a post-pass validation step, and give an error if this is the case.

regehr commented 4 years ago

Hi Erich, again I don't understand why this caused C-Reduce to not do anything. What is supposed to happen is that if C-Reduce creates a bad variant for any reason, this variant is rejected by your interestingness test, and then C-Reduce backs off and tries other things. Perhaps you can explain in more detail why this is not feasible here.

erichkeane commented 4 years ago

That was my understanding, but it seems that pass_line_markers does NOT do the interestingness test afterwards, at least in my 2.10 build. I also noticed pass_comments did the same (see the bug before this one, #216 I believe).

regehr commented 4 years ago

Hi Erich, a variant is only accepted as the basis for further reduction once it passes the interestingness test, so it might have passed at least once. If a variant is accepted without passing the test then there's a major bug in C-Reduce, but I do not know of any such bugs.

(this applies to your other bug report as well, so I won't repeat it there)

erichkeane commented 4 years ago

So I tried a min repro, and I believe THIS part might be a result of me "holding it wrong". In my .sh file I was doing the full path to the file, not local. I misinterpreted the 'C-Reduce cannot run because the interestingness test does not return zero' error message, and put the full-path to the file in my compiler invocation. So I don't think this bug is valid.

While I think a diagnosis here would be useful (since I would presume pass_line_markers should be pretty reliable), I don't think this is a bug here.