http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52484
Bug #: 52484 Summary: Wrong code from ce3 pass (deletes insn) Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@gcc.gnu.org Target: avr The following code for AVR target that reads from address space __memx result in wrong code: long readx (const __memx long *p) { return *p; } == compile == $ avr-gcc flash.c -S -dp -Os -mmcu=avr51 -da == configure == ../../gcc.gnu.org/trunk/configure --target=avr --prefix=/gnu/install/gcc-4.7 --disable-nls --with-dwarf2 --enable-checking=yes,rtl --enable-languages=c,c++ GNU C (GCC) version 4.8.0 20120304 (experimental) (avr) SVN 184887 from 2012-03-04 To see the bug RTL dumps will follow. There is really bloaty code from lower-subreg that splits the 4-byte move into 4 individual byte moves. After pass .peephole2 there are 4 xload_qi_libgcc insns that perform these moves. After pass .ce3 one of these moves is gone, this is wrong because no byte must be thrown away.