Command line: gcc -O -ftree-vrp -m32 -fcompare-debug 20030324-1.c Tested revisions: r157965 - fail r153685 - fail Compiler output: $ /mnt/svn/gcc-trunk/binary-157965-lto/bin/gcc -O -ftree-vrp -m32 -fcompare-debug testcase.c gcc: testcase.c: -fcompare-debug failure (length)
Created attachment 20324 [details] reduced testcase reduced from gcc/testsuite/gcc.dg/20030324-1.c Command line: gcc -O -ftree-vrp -m32 -fcompare-debug pr43670.c -g results in different code being generated
Ugh, apparently nothing clears TREE_ADDRESSABLE on x when not -g, only with -g (x really isn't addressable in the end). So, here -g generates better code than -g0.
I've messed this up. Of course it is the other way around, and it is discover_nonconstant_array_refs that marks x TREE_ADDRESSABLE because of an occurrence in DEBUG_STMT. Sorry for the previous premature comment.
Created attachment 20329 [details] gcc45-pr43670.patch Untested fix.
Subject: Bug 43670 Author: jakub Date: Thu Apr 8 09:16:28 2010 New Revision: 158108 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158108 Log: PR debug/43670 * cfgexpand.c (expand_debug_expr): If for non-NULL offset op0 is not a MEM, just return NULL instead of assertion failure. (discover_nonconstant_array_refs): Don't walk debug stmts. * gcc.dg/pr43670.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr43670.c Modified: trunk/gcc/ChangeLog trunk/gcc/cfgexpand.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 43670 Author: jakub Date: Thu Apr 8 09:17:52 2010 New Revision: 158109 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158109 Log: PR debug/43670 * cfgexpand.c (expand_debug_expr): If for non-NULL offset op0 is not a MEM, just return NULL instead of assertion failure. (discover_nonconstant_array_refs): Don't walk debug stmts. * gcc.dg/pr43670.c: New test. Added: branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr43670.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/cfgexpand.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Fixed.