https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90963

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-06-24
                 CC|                            |wilco at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to John David Anglin from comment #0)

Looking into this, pa.md is one of a few targets which defines builtin_longjmp.
This subtracts 8 from the loaded frame pointer, but that's now wrong since the
hard frame pointer is store. So this also needs to be updated like
nonlocal_goto:

--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -8713,7 +8710,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
   emit_insn (gen_blockage ());
   emit_clobber (hard_frame_pointer_rtx);
   emit_clobber (frame_pointer_rtx);
-  emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
+  emit_move_insn (hard_frame_pointer_rtx, fp);

   emit_use (hard_frame_pointer_rtx);
   emit_use (stack_pointer_rtx);

After this setjmp-1.c looks correct:

sub2:
        .PROC
        .CALLINFO FRAME=64,NO_CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3
        .ENTRY
        copy %r3,%r1
        stw %r2,-20(%r30)
        copy %r30,%r3
        stwm %r1,64(%r30)
        addil LR'buf-$global$,%r27
        ldo RR'buf-$global$(%r1),%r28
        ldw 0(%r28),%r19  // load hard frame pointer
        ldw 4(%r28),%r1
        ldw 8(%r28),%r30
        copy %r19,%r3    // assign hfp with offset 0
        be,n 0(%sr4,%r1)


main
        ...
        stw %r30,8(%r1)
        stw %r28,4(%r1)
        ldo 512(%r30),%r30
        depi 0,31,3,%r20
        stw %r3,0(%r1)     // store hard frame pointer
        ldi 0,%r28
        ldi 115,%r21

I can commit this if you like or do you want to test it first?

Reply via email to