[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [creduce-dev] [RFC] Adding passes for reducing clang crash reports

I created a PR for a line markers pass - it uses essentially the same binary search removal structure that pass_lines uses.


On Wed, Feb 13, 2019 at 3:27 PM Amy Huang <akhuang@google.com> wrote:
Hi John,

Thanks for the response-- so it seems like most of these could be handled with by existing passes and unifdef, but with small modifications or reorderings. For example, as Reid mentioned, the includes pass is run before unifdef, and it takes a while to run in these cases. 

Regarding the pass_blank run, the reason it doesn't work for us is that removing all # lines causes the interestingness test to fail. It seems like it would be helpful though to do multiple iterations of pass_blank similarly to how pass_lines is structured?


On Wed, Feb 13, 2019 at 1:49 PM John Regehr <regehr@cs.utah.edu> wrote:
Hi Amy,

I agree that reducing include-heavy C++ is clunky.

Before running C-Reduce, I usually preprocess using "-P" which leaves
out the line markers.  I guess that doesn't help you if you are using a
file produced by an automated crash reporter.

As Eric says, unifdef may help, it is already run very early in the pass
schedule. There may be issues in this pass that could be cleaned up to
make it do a better job.

Another pass that runs very early is pass_blank, which attempts to
remove all lines starting with #. If this works it should give you what
you want.

I would suggest doing a bit of experimentation where you look at some of
our passes that should in principle do the job you want, and run just
those passes alone, and see if they're doing anything useful. You can
run an individual pass by clearing C-Reduce's pass schedule and
explicitly adding the pass you like (see the command line help for the


On 2/13/19 2:10 PM, Amy Huang wrote:
> Hi all,
> Reducing crashes in clang is a common task for compiler developers, so
> we would like to make it faster. Clang produces crash reports using
> “clang -E -frewrite-includes”, which leaves behind macro defines, line
> markers, ifdefs, etc. It does this because sometimes diagnostics and
> crashes in diagnostic code depend on the pre-processor state controlled
> by these directives. For example,
> - Sometimes when line markers are removed, errors in system headers are
> no longer suppressed; this prevents the original crash from occurring
> - Sometimes the crash depends on macros
> Some of the code patterns that -frewrite-includes produces are line
> markers, #defines, and #includes contained in this type of ifelse block:
> #if 0
> #include "foo.h"
> #else
> // contents of foo.h
> #endif
> Currently CReduce removes the includes one by one at the beginning, and
> most of the other stuff in the lines pass, which is time consuming
> especially as they don't get collapsed by topformflat. Basically what we
> want to do is have some sort of pass to remove/simplify the line
> markers, macros, and ifs at the beginning. Maybe it could be added as an
> additional pass, or maybe as a sort of clang preprocessor step?
> Any thoughts or suggestions?