Created attachment 47849 [details] gzipped C source code For the attached C code, with compiler flag -O3, sometime between 20200207 and 20200210, does this: ../results.20200207/bin/gcc ../results.20200210/bin/gcc during IPA pass: cp c_code/2_2/@msem.nim.c:43465:1: internal compiler error: in propagate_vals_acros s_arith_jfunc, at ipa-cp.c:2039 0x821b89 propagate_vals_across_arith_jfunc ../../trunk.git/gcc/ipa-cp.c:2039 0x19364e5 propagate_vals_across_pass_through ../../trunk.git/gcc/ipa-cp.c:2093 0x19364e5 propagate_scalar_across_jump_function ../../trunk.git/gcc/ipa-cp.c:2171 0x19364e5 propagate_constants_across_call ../../trunk.git/gcc/ipa-cp.c:2867 I will have my usual go at reducing the code.
Reduced C code is: typedef struct a a; struct a { a *b } d; e, k, ah, al; f(aa) { if (aa & 1) goto g; f(aa | 2); g: h(); } l() { { f(072); i(e, d, 92); } } ag() { { i(e, d, 36); } } ai(a *m, a *n, unsigned aa) { f(aa); j(k, l, ah, 1); } j(int c, a m, int aj, int aa) { int ak = aa; { i(e, d, ak); } } i(int c, a *m, unsigned aa) { { { i(c, (*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*( *(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*( *(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*(*m).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b) .b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b) .b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b) .b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b) .b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b).b, 0); } } int am = aa; ai(ag, al, am); }
Bisection points to r10-6540: commit a0f6a8cb414b687f22c9011a894d5e8e398c4be0 Author: Feng Xue <fxue@os.amperecomputing.com> Date: Tue Jan 21 20:53:38 2020 +0800 Generalized value pass-through for self-recusive function (PR ipa/93203)
The master branch has been updated by Jeff Law <law@gcc.gnu.org>: https://gcc.gnu.org/g:47772af10c00f7e1e95cd52557fc893dc602a420 commit r10-6791-g47772af10c00f7e1e95cd52557fc893dc602a420 Author: Feng Xue <fxue@os.amperecomputing.com> Date: Mon Feb 17 17:07:04 2020 +0800 Do not propagate self-dependent value (PR ipa/93763) PR ipa/93763 * ipa-cp.c (self_recursively_generated_p): Mark self-dependent value as self-recursively generated.
The master branch has been updated by Jeff Law <law@gcc.gnu.org>: https://gcc.gnu.org/g:25f0909af87171395d9ee21cf2873f4d9b5ebc91 commit r10-6792-g25f0909af87171395d9ee21cf2873f4d9b5ebc91 Author: Jeff Law <law@redhat.com> Date: Fri Feb 21 13:24:27 2020 -0700 Do not propagate self-dependent value (PR ipa/93763) (ChangeLog) PR ipa/93763 * ipa-cp.c (self_recursively_generated_p): Mark self-dependent value as self-recursively generated.
Fixed by Feng's patch on the trunk.
*** Bug 93799 has been marked as a duplicate of this bug. ***
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:103bc4db7665a03bf2390ccc8ceca0dc5a7a81b7 commit r10-6835-g103bc4db7665a03bf2390ccc8ceca0dc5a7a81b7 Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Feb 25 09:05:57 2020 +0100 testsuite: Fix recently added ipa testcases [PR93763] Seems the test has been badly reduced (if the original doesn't emit warnings, it is always better in the reduction script avoid introducing new ones). Also, the g++.dg/ipa/ test fails with -std=c++98 because it is written in C++11. 2020-02-25 Jakub Jelinek <jakub@redhat.com> PR ipa/93763 * gcc.dg/ipa/pr93763.c: Adjust the test so that it compiles without warnings and still ICEs before the ipa-cp.c fix. * g++.dg/ipa/pr93763.C: Require c++11 effective target.
(In reply to CVS Commits from comment #7) > Seems the test has been badly reduced (if the original doesn't emit > warnings, it is always better in the reduction script avoid introducing > new ones). I am no expert at creduce. Any guidance on suitable flags for this case, or indeed the general case, would be most welcome. Should, for instance, -std=xyz flags be preserved ?
(In reply to David Binderman from comment #8) > (In reply to CVS Commits from comment #7) > > Seems the test has been badly reduced (if the original doesn't emit > > warnings, it is always better in the reduction script avoid introducing > > new ones). > > I am no expert at creduce. Any guidance on suitable flags for this > case, or indeed the general case, would be most welcome. > > Should, for instance, -std=xyz flags be preserved ? Sorry for intervening. If you ask me, I have this in my reduction script: $GCCBINARY_GOOD -w -c $GCCOPTS_GOOD $INPUTFILE || exit 1 timeout 8 $GCCBINARY_BAD -w -c $GCCOPTS_BAD $INPUTFILE > $OUTPUTFILE 2>&1 && exit 1 where $GCCBINARY_BAD obviously corresponds to a version that has an issue in question and $GCCBINARY_GOOD to a version that doesn't, similarly for the sets of flags. It works in most cases where ICEs happen on inherently valid code.
Really depends on the original source, but e.g. if the original testcase doesn't have any warnings, then it would be better for the reduction script to avoid introducing new warnings (so for start don't use -w in there). Sometimes trying to avoid e.g. introducing -Wmaybe-uninitialized warnings or similar might prevent reduction of the testcase into something short. Sometimes you might just want to attempt avoiding introduction of a small selected subset of warnings, e.g. punt on (for C): warning: data definition has no type or storage class warning: no semicolon at end of struct or union -Wimplicit-int -Wimplicit-function-declaration -Wincompatible-pointer-types And of course, when the testcase is reduced without that, whomever creates a patch where it adds those into the testsuite, it should be tested; if one tweaks the test after performing a bootstrap/regtest, it might be enough to do make check-gcc check-c++-all RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} dg.exp=pr12345*" style testing just to make sure the test actually passes.
(In reply to Jakub Jelinek from comment #10) > Really depends on the original source, but e.g. if the original testcase > doesn't have any warnings, then it would be better for the reduction script > to avoid introducing new warnings (so for start don't use -w in there). Thanks for your advice, but almost all original source code in practice has warnings. > And of course, when the testcase is reduced without that, whomever creates a > patch where it adds those into the testsuite, it should be tested; if one > tweaks the test after performing a bootstrap/regtest, it might be enough to > do > make check-gcc check-c++-all RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} > dg.exp=pr12345*" > style testing just to make sure the test actually passes. I generally find that if the original source code and the reduced source code and any tweeked reduced source code all don't demonstrate the problem, then the problem is fixed. I keep old bug reports and - usually weekly - make sure there is no regression. A simple shell script and a diff is usually enough. For the record, here is my latest script to creduce: (/usr/bin/gcc -c -w bug584.c && /home/dcb/gcc/results/bin/gcc -c -w -O3 bug584.c) 2>&1 | fgrep "internal compiler error: in propagate_vals_across_arith_jfunc, at ipa-cp.c:2039" Using -w means I don't have to wade through a lot of text I am not interested in to find the internal compiler error.