======================================================================================== > avr-gcc -v Using built-in specs. Target: avr Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr/lib --infodi--mandir=/usr/share/man --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --enabystem-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking--build=i486-linux-gnu --host=i486-linux-gnu --target=avr Thread model: single gcc version 4.3.4 (GCC) ======================================================================================== Minimal source code causing the bug, removing any token makes the compiler work OK. No header is to be included into this code to see the bug. ----------- void doit( ) { char *pk=0 ; for(;;) { asm ( "nop" : :"m"(pk++) ); asm ( "nop" : :"m"(pk++) ); } } ======================================================================================== > avr-gcc -Wall -mmcu=atmega128 -O3 -c -o /dev/null /tmp/present-wddl-both-encrypt.c /tmp/present-wddl-both-encrypt.c: In function ‘doit’: /tmp/present-wddl-both-encrypt.c:2: internal compiler error: in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:577 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. ======================================================================================== Note that removing "-Wall" does not remove the bug but that removing "-O3" makes the compiler work OK. Best regards.
Well, we have not properly gimplified the invalid function: doit () { char * pk; char * pk.1; char * pk.0; <bb 2>: pk = 0B; <bb 3>: __asm__ __volatile__("nop"::"m" pk); pk = pk + 1; pk.0 = pk; __asm__ __volatile__("nop"::"m" pk.0); pk.1 = pk.0 + 1; pk = pk.1; goto <bb 3>; pk is addressable, so pk + 1 needs to load from pk first. 3.4.x prints t.i: In function `doit': t.i:6: warning: use of memory input without lvalue in asm operand 0 is deprecated t.i:7: warning: use of memory input without lvalue in asm operand 0 is deprecated t.i:6: error: impossible constraint in `asm' t.i:7: error: impossible constraint in `asm' so we ICE on the invalid asm. We also fail to diagnose this with newer compilers (but the gimple verifier triggers with checking enabled).
Created attachment 20362 [details] gcc46-pr43690.patch This is very ugly. Either we should reject all these during gimplification ("m" (x+1) is also rejected during gimplification), or for POST{IN,DE}CREMENT_EXPR we could mark its operand as addressable in the FEs (but that wouldn't solve PRE{IN,DE}CREMENT_EXPR which would ICE anyway). Or FEs would need to reject this.
GCC 4.3.5 is being released, adjusting target milestone.
Author: jakub Date: Fri Nov 5 11:11:50 2010 New Revision: 166354 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166354 Log: PR middle-end/43690 * gimplify.c (gimplify_asm_expr): If a "m" input is a {pre,post}{in,de}crement, fail. * c-c++-common/pr43690.c: New test. Added: trunk/gcc/testsuite/c-c++-common/pr43690.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimplify.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk.
Author: jakub Date: Thu Nov 11 20:36:49 2010 New Revision: 166617 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166617 Log: Backport from mainline 2010-11-05 Jakub Jelinek <jakub@redhat.com> PR middle-end/43690 * gimplify.c (gimplify_asm_expr): If a "m" input is a {pre,post}{in,de}crement, fail. * c-c++-common/pr43690.c: New test. Added: branches/gcc-4_5-branch/gcc/testsuite/c-c++-common/pr43690.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/gimplify.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Author: jakub Date: Fri Nov 12 11:30:27 2010 New Revision: 166650 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166650 Log: Backport from mainline 2010-11-05 Jakub Jelinek <jakub@redhat.com> PR middle-end/43690 * gimplify.c (gimplify_asm_expr): If a "m" input is a {pre,post}{in,de}crement, fail. * c-c++-common/pr43690.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/c-c++-common/pr43690.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
4.3 branch is being closed, moving to 4.4.7 target.
Patches were committed some time ago. Does this bug need to be marked as RESOLVED FIXED?
Fixed.