https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109027
Tobias Specht <specht.tobias at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |specht.tobias at gmx dot de
--- Comment #11 from Tobias Specht <specht.tobias at gmx dot de> ---
A much smaller C reproducer (no headers, no options besides -fanalyzer):
int f(int *c, int b)
{
*c = b - 1;
return *c != b + 1 || *c != b;
}
$ gcc -fanalyzer -c pr109027.c
gcc: internal compiler error: Segmentation fault signal terminated program cc1
Fails with gcc 16.2.0 (Debian 16.2.0-6) and 14.2.0 (Debian 14.2.0-19).
It needs -fanalyzer at -O0: adding -O1 or -O2 makes the ICE go away, and
without -fanalyzer the file compiles fine. Backtrace (Debian cc1, no debug
info) shows the same cycle as comment #2:
ana::constraint_manager::eval_condition
ana::constraint_manager::impossible_derived_conditions_p
ana::region_model_manager::get_or_create_binop
ana::region_model_manager::maybe_fold_binop
ana::constraint_manager::eval_condition
...
i.e. presumably *c == b-1 is in one equivalence class, and evaluating
*c != b+1 makes impossible_derived_conditions_p substitute back and forth
between b-1 and b+1 without bound.
Note that the testcase from PR 111099 (marked as a possible duplicate in
comment #6) no longer ICEs on 16.2 (fixed as a side effect of
r16-6063-g0b786d961d4426, per the regression test added for it), but this
one still does, so the recursion itself remains. With an unlimited stack
cc1 does not crash but keeps allocating memory instead.
It was found by running -fanalyzer over automatically generated C test
programs; the original 1.8k-line file reduced to the above with cvise.