[Bug target/86040] [avr]: RAMPZ is not always cleared after loading __flashN data
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 16 12:16:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86040
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-07-16
Ever confirmed|0 |1
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
IMO the problem are the early returns in avr.c::avr_out_lpm() that bypass the
reset to 0 of RAMPZ at the end of that function if RAMPD is present:
http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/avr/avr.c?view=markup&pathrev=257301#l3703
Affected is code for the devices in -mmcu=avrxmega5 and avrxmega7. A test case
for 1-byte reads is
char func1 (const __flash2 char *p)
{
return *p;
}
func1:
movw r30,r24 ; 16 [c=4 l=1] *movhi/0
ldi r18,2 ; 11 [c=4 l=3] movqi_insn/3
out __RAMPZ__,r18
elpm r24,Z
/* epilogue start */
ret ; 19 [c=0 l=1] return
I found no code to cover the wrong parts of the 2-byte and 4-byte reads.
More information about the Gcc-bugs
mailing list