https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64242
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Last reconfirmed|2018-11-29 00:00:00 |2024-12-4
--- Comment #42 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
The pr64242.c test case also FAILs on avr with v14.2 and current trunk (future
v15).
In the .expand dump, there is basically this:
;; __builtin_longjmp (&buf, 1);
(insn 13 12 14 (set (reg:HI 47)
(mem:HI (plus:HI (reg/f:HI 38 virtual-stack-vars)
(const_int 2 [0x2])) [4 S2 A8])) "pr64242.c":12:3 -1
(nil))
...
(insn 16 15 17 (set (reg/f:HI 28 r28)
(mem:HI (reg/f:HI 38 virtual-stack-vars) [4 S2 A8])) "pr64242.c":12:3
-1
(nil))
...
(insn 19 18 20 (set (reg/f:HI 32 __SP_L__)
(mem:HI (plus:HI (reg/f:HI 38 virtual-stack-vars)
(const_int 4 [0x4])) [4 S2 A8])) "pr64242.c":12:3 -1
(nil))
Insn 13 is loading the jump address and is correct.
Insn 16 is setting the frame-poiner r28:HI to buf[0].
Insn 19 is reading SP from the frame buf[4], but the frame-pointer has already
been changed, hence SP will contain garbage.