https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81996
--- Comment #8 from Alan Modra <amodra at gcc dot gnu.org> --- Author: amodra Date: Thu Sep 21 12:55:37 2017 New Revision: 253067 URL: https://gcc.gnu.org/viewcvs?rev=253067&root=gcc&view=rev Log: PR81996, __builtin_return_address(0) fails rs6000_return_addr assumes that the stack link is at frame+0, which is true for count>0. For count==0, rs6000_return_addr is called with frame==frame_pointer_rtx and the stack link is *not* at frame+0 if -fstack-protector-all or -fsanitize=address because rs6000.h sets FRAME_GROWS_DOWNWARD for those options. PR target/81996 * gcc/config/rs6000/rs6000.c (rs6000_return_addr): Use stack_pointer_rtx for count 0. Update comments. Break up large rtl expression. Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/rs6000/rs6000.c