https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67770

            Bug ID: 67770
           Summary: i386: -fshrink-wrap can interact badly with
                    trampolines
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.von.s at posteo dot de
  Target Milestone: ---

Created attachment 36419
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36419&action=edit
Miscompiled program

Compiling the attached program with -m32 -DCRASH=1 produces a crash on run
time. Without either switch, the program runs fine (the host is x86-64).

The reason for crashing can be revealed by inspecting the generated assembly:
the instruction which pushes the trampoline context on the stack is moved along
with the frame setup code from the very start of the function where the
trampoline expects it to be. The crucial optimisation seems to be
-fshrink-wrap; however, for some reason I was unable to trigger the bug without
enabling the full -O1 optimisation level, even by manually listing all the
-f... options enabled by -O1.

Reply via email to