https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126662
--- Comment #2 from John David Anglin <danglin at gcc dot gnu.org> --- Created attachment 65258 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65258&action=edit Assembler output at -O1 Note that arg5, arg6 and arg7 are stored on the stack (register %r30) at offsets -52, -56 and -60 before call to foo in main. They are not optimized out. Test passes execution test. When I run program manually under gdb, I see: dave@mx3210:~/gnu/gcc/objdir/gcc/testsuite/gcc$ gdb pr36728-1.exe GNU gdb (Debian 17.2-1+b1) 17.2 Copyright (C) 2025 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "hppa-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from pr36728-1.exe... (gdb) break foo Breakpoint 1 at 0x10478: file /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/guality/pr36728-1.c, line 11. (gdb) r Starting program: /home/dave/gnu/gcc/objdir/gcc/testsuite/gcc/pr36728-1.exe ⚠️ warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. Breakpoint 1, foo (arg1=1, arg2=2, arg3=3, arg4=4, arg5=<error reading variable: Cannot access memory at address 0xffffffcc>, arg6=<error reading variable: Cannot access memory at address 0xffffffc8>, arg7=<error reading variable: Cannot access memory at address 0xffffffc4>) at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/guality/pr36728-1.c:11 11 { (gdb) step 12 char *x = __builtin_alloca (arg7); (gdb) 15 y = 2; (gdb) 16 asm (NOP : "=m" (y), "=m" (b) : "m" (y)); (gdb) bt #0 foo (arg1=1, arg2=2, arg3=3, arg4=4, arg5=<optimized out>, arg6=<optimized out>, arg7=<optimized out>) at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/guality/pr36728-1.c:16 #1 0x0001050c in main () at /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/guality/pr36728-1.c:51 It seems gdb doesn't include stack offset of the callee frame when it tries to load arg5, arg6 and arg7.
