https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108996
--- Comment #9 from Ulrich Weigand <uweigand at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #7) > (In reply to Ulrich Weigand from comment #4) > > (In reply to Jakub Jelinek from comment #3) > > > What is done on other arches? > > > > That depends on the platform ABI. On some arches, including x86/x86_64 and > > arm/aarch64, the ABI requires the generated code reloads the return buffer > > pointer into a defined register at function exit (either the same it was in > > on function entry, or some other ABI-defined register). On those arches, > > GDB can at least inspect the return value at the point the function return > > happens. > > aarch64 does not require that. GCC produces it yes but that is a missed > optimization, see PR 103010 which I filed against GCC for that case. Well, I was looking at GDB code that at least *assumes* that the aarch64 ABI does require that: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/aarch64-tdep.c;h=5b1b9921f87e588f8251a77d858f8f312be1e5ac;hb=HEAD#l2500 If this is incorrect, I guess GDB would have to be fixed.