diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 4a99c3f12a78..3a2d179c7668 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,8 @@ +2020-01-27 David Malcolm + + PR analyzer/93349 + * engine.cc (run_checkers): Save and restore input_location. + 2020-01-27 David Malcolm * call-string.cc (call_string::cmp_1): Delete, moving body to... diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 8961c557c497..2bc0aff6a6e4 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -3589,6 +3589,9 @@ impl_run_checkers (logger *logger) void run_checkers () { + /* Save input_location. */ + location_t saved_input_location = input_location; + /* Handle -fdump-analyzer and -fdump-analyzer-stderr. */ FILE *dump_fout = NULL; /* Track if we're responsible for closing dump_fout. */ @@ -3619,6 +3622,11 @@ run_checkers () if (owns_dump_fout) fclose (dump_fout); + + /* Restore input_location. Subsequent passes may assume that input_location + is some arbitrary value *not* in the block tree, which might be violated + if we didn't restore it. */ + input_location = saved_input_location; } } // namespace ana diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 56acbd926adf..b4f298a7ea09 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-01-27 David Malcolm + + PR analyzer/93349 + * gcc.dg/analyzer/torture/pr93349.c: New test. + 2020-01-27 David Malcolm PR analyzer/93291 diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93349.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93349.c new file mode 100644 index 000000000000..a9d063677222 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93349.c @@ -0,0 +1,4 @@ +__attribute__ ((simd)) void +test (void) +{ +}