https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71732
Bug ID: 71732 Summary: FAIL: gcc.dg/torture/pr71532.c at -O2 and above Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: danglin at gcc dot gnu.org CC: jakub at gcc dot gnu.org, law at gcc dot gnu.org Target Milestone: --- Host: hppa*-*-* (32 bit) Target: hppa*-*-* (32 bit) Build: hppa*-*-* (32 bit) Created attachment 38816 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38816&action=edit assembler output The following fails of gcc.dg/torture/pr71532.c occur on 32-bit hppa: FAIL: gcc.dg/torture/pr71532.c -O2 execution test FAIL: gcc.dg/torture/pr71532.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test FAIL: gcc.dg/torture/pr71532.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test FAIL: gcc.dg/torture/pr71532.c -O3 -g execution test FAIL: gcc.dg/torture/pr71532.c -Os execution test Looking at the -O2 build, it appears the last argument passed on the stack to bar is off by one: (gdb) x/32x $sp-128 0xfd703380: 0x000f2000 0xfcc56b20 0x00011146 0x0001110c 0xfd703390: 0x000101e8 0x00117488 0x00000000 0x000f2000 0xfd7033a0: 0xfcc56b20 0x00011146 0x00000000 0x000103d3 0xfd7033b0: 0x0000000d 0x0000000b 0x0000000a 0x00000009 0xfd7033c0: 0x00000008 0x00000007 0x00000006 0x00000005 0xfd7033d0: 0x00000005 0x00000004 0x00000003 0x00000002 0xfd7033e0: 0xfd47e3c8 0x00000000 0xfd47c1ac 0x00010a1b 0xfd7033f0: 0x00000000 0x00000000 0x00000000 0x00000000 (gdb) p/x $sp $7 = 0xfd703400 (gdb) bt #0 bar (a=a@entry=1, b=b@entry=2, c=c@entry=3, d=d@entry=4, e=<optimized out>, f=<optimized out>, g=<optimized out>, h=<optimized out>, i=<optimized out>, j=<optimized out>, k=<optimized out>, l=<optimized out>) at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/pr71532.c:17 #1 0x00010a4c in test () at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/pr71532.c:29 #2 0x00010410 in main () at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/pr71532.c:36 (gdb) p $r26 $8 = 1 (gdb) p $r25 $9 = 2 (gdb) p $r24 $10 = 3 (gdb) p $r23 $11 = 4 The stack argument slots start at 0xfd7033dc and go to 0xfd7033b0. The first four arguments are passed in r26-r23 and are reserved for use by callee. They are not set by caller. Need to look at argument setup in test.