This is seen using r143187 on Ubuntu Hardy on x86. PR 32431 reports a similar failure but at a different line number, and for the 68HC11 target. regehr@john-home:~/volatile/tmp117$ current-gcc -c -O2 -march=i686 small.c small.c: In function ‘foo’: small.c:17: internal compiler error: in df_refs_verify, at df-scan.c:4307 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. regehr@john-home:~/volatile/tmp117$ cat small.c int safe_add_func_int64_t_s_s (int _si1, int _si2) { return 1 > 9223372036854775807LL - _si2 && 1 - _si2 ? : 1 + _si2; } volatile int g_55; void func_42 (int p_43, int p_44, int p_46, int p_47) { p_44 & 1 && g_55, !1; } void foo (int p_38) { int l_84 = 0; func_42 (1, safe_add_func_int64_t_s_s (p_38, 1 >= safe (1)), l_84, 1); } regehr@john-home:~/volatile/tmp117$ current-gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion Thread model: posix gcc version 4.4.0 20090108 (experimental) (GCC)
Confirmed.
i will have my best people work on it.
Created attachment 17068 [details] patch to cause df to verify after every patch this is a combine bug. The df verification fails after combine makes some modification to the cc arg of insn 28 in the foo function that bypasses the implicit and explicit calls to mark the insn as being changed. I am looking into trying to figure out what path thru combine is doing this. However, if some combine expert (or just someone who wants to prove that they have better skill with the debugger than I do) wants to get there first, be my guest. I have attached a patch that improves some of the debugging and causes df to verify after every pass. This patch causes the failure to move from being in ira, to the start of if conversion after combine.
Simplified testcase: extern int bar (void); volatile int g; int foo (void) { int a = 1 >= bar (); if ((1 > 9223372036854775807LL - a && 1 - a ? : 1 + a) & 1) return g; return 0; }
The single CC user is modified, then those changes are reverted, but unfortunately they aren't reverted by putting back the old content, but instead tweaking the new comparison with PUT_CODE. SUBST (*cc_use, gen_rtx_fmt_ee (new_code, GET_MODE (*cc_use), dest, const0_rtx)); other_changed = 1; ... if ((recog_for_combine (&pat, other_insn, ¬e) < 0 && ! check_asm_operands (pat))) { PUT_CODE (*cc_use, old_code); other_changed = 0; We should insert put there the old *cc_use rtx. I'll test a patch.
Created attachment 17094 [details] gcc44-pr38774.patch Patch I'm going to bootstrap/regtest. Fixes the testcase on both i686-linux and x86_64-linux.
(In reply to comment #6) > Created an attachment (id=17094) [edit] > gcc44-pr38774.patch > > Patch I'm going to bootstrap/regtest. Fixes the testcase on both i686-linux > and x86_64-linux. Do you think the testcase could go into gcc.dg/torture/ instead of just gcc.dg and remove the -O2 part of dg-options ?
Subject: Bug 38774 Author: jakub Date: Tue Jan 13 22:36:06 2009 New Revision: 143355 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143355 Log: PR rtl-optimization/38774 * combine.c (simplify_set): When undoing cc_use change, don't do PUT_CODE on the newly created comparison, but instead put back the old comparison. * gcc.dg/torture/pr38774.c: New test. Added: trunk/gcc/testsuite/gcc.dg/torture/pr38774.c Modified: trunk/gcc/ChangeLog trunk/gcc/combine.c trunk/gcc/testsuite/ChangeLog
Fixed.