This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82221] internal compiler error: in print_reg, at config/i386/i386.c:17656
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 Sep 2017 19:54:12 +0000
- Subject: [Bug target/82221] internal compiler error: in print_reg, at config/i386/i386.c:17656
- Auto-submitted: auto-generated
- References: <bug-82221-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82221
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Josh Poimboeuf from comment #9)
> I might be misunderstanding, but I don't think we need DRAP for our use
> case. We just need assurance that the frame pointer (RBP) has been set up
> before the inline asm is inserted.
>
The problem is
#define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap)
Since function returns 64-bit integer and incoming stack is aligned to
32 bits, initially GCC assume stack realignment is needed. If need_drap
is false, stack_realign_fp is true. In this case, we won't eliminate
frame pointer with stack pointer
static bool
ix86_can_eliminate (const int from, const int to)
{
if (stack_realign_fp)
return ((from == ARG_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == STACK_POINTER_REGNUM));
else
return to == STACK_POINTER_REGNUM ? !frame_pointer_needed : true;
}
when sp_is_unchanging is false. Setting need_drap when sp_is_unchanging is
false allows it to work. BTW, drap is really used since stack_realign_needed
is changed to false by ix86_finalize_stack_frame_flags.