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

            Bug ID: 118018
           Summary: FAIL: gcc.c-torture/execute/nestfunc-5.c   -O1
                    execution test
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 59850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59850&action=edit
Preprocessed source.

spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir/gcc/xgcc
-B/home/dave/gnu/gcc/obj
dir/gcc/
/home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c
 -fdiagnostics-plain-output -O1 -w -lm -o ./nestfunc-5.exe
PASS: gcc.c-torture/execute/nestfunc-5.c   -O1  (test for excess errors)
Setting LD_LIBRARY_PATH to
:/home/dave/gnu/gcc/objdir/gcc::/home/dave/gnu/gcc/ob
jdir/gcc:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libstdc++-v3/src/.libs:/home/d
ave/gnu/gcc/objdir/hppa-linux-gnu/libssp/.libs:/home/dave/gnu/gcc/objdir/hppa-li
nux-gnu/libphobos/src/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libgm2/.lib
s:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libgomp/.libs:/home/dave/gnu/gcc/objd
ir/hppa-linux-gnu/libatomic/.libs:/home/dave/gnu/gcc/objdir/./gcc:/home/dave/gnu
/gcc/objdir/./prev-gcc:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libstdc++-v3/src
/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libssp/.libs:/home/dave/gnu/gcc/
objdir/hppa-linux-gnu/libphobos/src/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-g
nu/libgm2/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libgomp/.libs:/home/dav
e/gnu/gcc/objdir/hppa-linux-gnu/libatomic/.libs:/home/dave/gnu/gcc/objdir/./gcc:
/home/dave/gnu/gcc/objdir/./prev-gcc
Execution timeout is: 300
spawn [open ...]
FAIL: gcc.c-torture/execute/nestfunc-5.c   -O1  execution test

/home/dave/gnu/gcc/objdir/gcc/cc1 -fpreprocessed ./nestfunc-5.i -quiet -dumpdir
./ -dumpbase nestfunc-5.c -dumpbase-ext .c -march=2.0 -mlra -O1 -w -version
-fdiagnostics-color=never -fdiagnostics-urls=never -fno-diagnostics-show-caret
-fno-diagnostics-show-line-numbers -fdiagnostics-path-format=separate-events
-fdiagnostics-text-art-charset=none -fno-diagnostics-show-event-links -o
./nestfunc-5.s

This only occurs with LRA generating 32-bit PA 2.0 code.  With legacy
reload, the frame pointer is eliminated.  The test also doesn't fail
when generating PA 1.1 code.

The function recursive is miscompiled:

recursive:
        .PROC
        .CALLINFO FRAME=192,CALLS,SAVE_RP
        .ENTRY
        stw %r2,-20(%r30)
        ldo 192(%r30),%r30
        stw %r26,-36(%r3)
        stw %r3,-184(%r30)

With LRA, frame_pointer_needed is not true.  As a result, pa_expand_prologue
doesn't generate the instructions to save r3 and copy the incoming stack
pointer to the frame pointer, r3.  In the above, r3 is not initialed.

We should have something like the following:

do_goto.0:
        .PROC
        .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3
        .ENTRY
        copy %r3,%r1
        copy %r30,%r3
        stw,ma %r1,64(%r30)

Reply via email to