DWARF: Allow hard frame pointer even if frame pointer isn't used
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 4 Sep 2018 20:42:06 +0000 (20:42 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 4 Sep 2018 20:42:06 +0000 (13:42 -0700)
commit6bc088ca0e315896c3efe1ed273f6a345e5418b8
tree3d3d5fc25fe9c14be6b2a015025f3846801904d4
parent8f93810d3b7cc7540e31397697f5df9db18daba4
DWARF: Allow hard frame pointer even if frame pointer isn't used

r251028

commit cd557ff63f388ad27c376d0a225e74d3594a6f9d
Author: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Aug 10 15:29:05 2017 +0000

    i386: Don't use frame pointer without stack access

    When there is no stack access, there is no need to use frame pointer
    even if -fno-omit-frame-pointer is used and caller's frame pointer is
    unchanged.

frame pointer may not be available even if -fno-omit-frame-pointer is
used.  When this happened, arg pointer may be eliminated by hard frame
pointer.  Since hard frame pointer is encoded with DW_OP_fbreg which
uses the DW_AT_frame_base attribute, not hard frame pointer directly,
we should allow hard frame pointer when generating DWARF info even if
frame pointer isn't used.

gcc/

PR debug/86593
* dwarf2out.c (based_loc_descr): Allow hard frame pointer even
if frame pointer isn't used.
(compute_frame_pointer_to_fb_displacement): Likewise.

gcc/testsuite/

PR debug/86593
* g++.dg/pr86593.C: New test.

From-SVN: r264096
gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr86593.C [new file with mode: 0644]