http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51374
Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Known to work| |4.7.0 Keywords| |wrong-code Last reconfirmed| |2011-12-01 Component|c |rtl-optimization CC| |gjl at gcc dot gnu.org Host|i386-redhat-linux | Ever Confirmed|0 |1 Summary|Volatile access reordered. |[avr] insn combine reorders | |volatile memory accesses Target Milestone|--- |4.6.3 Known to fail| |4.6.2 --- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-12-01 09:57:16 UTC --- Please, supply informations that are needed to reproduce bugs like explained in http://gcc.gnu.org/bugs.html/#need when you report bugs like compiler switches applied. Thanks. To reprodoce, optimization must be turned on: $ avr-gcc-4.6.2 test.c -Os -dp -S __vector_18: in r24,44-0x20 ; 8 *movqi/4 [length = 1] sbis 43-0x20,4 ; 12 *sbix_branch [length = 2] rjmp .L1 lds r24,slot.1198 ; 14 *movhi/2 [length = 4] lds r25,slot.1198+1 ldi r18,hi8(-2) ; 15 *cmphi/5 [length = 3] cpi r24,lo8(-2) cpc r25,r18 brne .L1 ; 16 branch [length = 1] ldi r24,lo8(-1) ; 18 *movhi/4 [length = 2] ldi r25,hi8(-1) sts slot.1198+1,r25 ; 19 *movhi/3 [length = 4] sts slot.1198,r24 .L1: ret ; 29 return [length = 1] avr-gcc-4.7.0 (trunk 181838) compiles correct with -O1/2/s/3, here with -Os: __vector_18: in r24,0xb ; 6 movqi_insn/4 [length = 1] in r25,0xc ; 8 movqi_insn/4 [length = 1] sbrs r24,4 ; 11 *sbrx_branchqi [length = 2] rjmp .L1 lds r24,slot.1321 ; 13 *movhi/3 [length = 4] lds r25,slot.1321+1 adiw r24,2 ; 14 *cmphi/7 [length = 1] brne .L1 ; 15 branch [length = 1] ldi r24,lo8(-1) ; 17 *movhi/5 [length = 2] ldi r25,lo8(-1) sts slot.1321+1,r25 ; 18 *movhi/4 [length = 4] sts slot.1321,r24 .L1: ret ; 35 return [length = 1]