AVR target built with specs: Using built-in specs. COLLECT_GCC=/home/vishnu.k_s/build-linux_x86_64/bldcc/gcc/xgcc Target: avr Configured with: ../gcc-trunk/configure --prefix=/home/vishnu.k_s/build-linux_x86_64//install --target=avr --enable-languages=c,c++ --disable-nls --with-gmp=/proj/install/gmp-4.3.2/ --with-mpfr=/proj/install/mpfr-2.4.2/ --with-mpc=/proj/install/mpc-0.8.2/ Thread model: single gcc version 4.9.0 20130326 (experimental) (GCC) Above compiler generate wrong code for testcase present in gcc.c-torture/execute/simd-1.c. gcc options : -O1 -mmcu=atmega1280 (snip of assembly) ldi r30,lo8(res) ; r30/r31 is loaded with address of res ldi r31,hi8(res) ; st Z,r24 ldd r31,Y+1 ; Modifying r31 register sts res+1,r31 sts res+2,r27 sts res+3,r26 sts res+4,r23 ... lds r22,res+4+2 lds r23,res+4+3 ld r24,Z ; regsiter pair r30/r31 is used to load from res ldd r25,Z+1 ldd r26,Z+2 ldd r27,Z+3 (snip of assembly) It looks like r31 is corrupted after reload pass.
This bug might be similar to PR56442, which is not reproducible in 4.9. conversation in mailing list : http://gcc.gnu.org/ml/gcc/2013-03/msg00121.html
It's a postreload bug.
The patch has been posted: http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00845.html
http://gcc.gnu.org/ml/gcc-cvs/2013-05/msg00874.html PR rtl-optimization/56833 * postreload.c (move2add_record_mode): New function. (move2add_record_sym_value, move2add_valid_value_p): Likewise. (move2add_use_add2_insn): Use move2add_record_sym_value. (move2add_use_add3_insn): Likewise. (reload_cse_move2add): Use move2add_valid_value_p and move2add_record_mode. Invalidate call-clobbered and REG_INC affected regs by setting reg_mode to VOIDmode. (move2add_note_store): Don't pretend the inside of a SUBREG is the actual destination. Invalidate single/leading registers by setting reg_mode to VOIDmode. Use move2add_record_sym_value, move2add_valid_value_p and move2add_record_mode.
This PR looks similar to PR56442 for the 4.8 branch. Does your patch fix that problem, too?
*** Bug 50891 has been marked as a duplicate of this bug. ***