MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

-fno-omit-frame-pointer with -O2 causes an ICE in gcc 14.1.0

Open 20k opened this issue 1 year ago • 2 comments

Description / Steps to reproduce the issue

Repro is attached. Download and extract, then compile it as such from the mingw64 terminal:

gcc -std=c++23 -fext-numeric-literals -fno-omit-frame-pointer -O2 repro.cpp

This produces the following output

during RTL pass: final
./deps/imgui/imgui.cpp: In function 'void ScaleWindow(ImGuiWindow*, float)':
./deps/imgui/imgui.cpp:3775:1: internal compiler error: in seh_cfa_offset, at config/i386/winnt.cc:1
137
 3775 | }
      | ^
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <https://github.com/msys2/MINGW-packages/issues> for instructions.

Compiling with -O1, or removing -fno-omit-frame-pointer fixes this crash. Unfortunately I was unable to get -freport-bug to work here!

repro.zip

Expected behavior

The compiler not ICEing

Actual behavior

The compiler ICEs when compiling most files

Verification

  • [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • [X] MINGW64
  • [ ] MINGW32
  • [x] UCRT64
  • [ ] CLANG64
  • [ ] CLANG32
  • [ ] CLANGARM64

Are you willing to submit a PR?

no idea where i'd even start

20k avatar May 10 '24 13:05 20k

Thanks, c-reduced to:

// gcc -c -fno-omit-frame-pointer -O2 repro.cpp
template <typename a> void b(a, a);
template <typename a> void c(a, a, float);
float d;
void e() {
  float f;
  c(f, f, d);
  b(0.0f, f);
}

lazka avatar May 10 '24 15:05 lazka

I've filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115038

lazka avatar May 10 '24 15:05 lazka

There is a temporary workaround now by passing -fno-fold-mem-offsets

lazka avatar May 12 '24 18:05 lazka

This is fixed in upstream too now: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2f0e0862406a17bb8bf4ad948ae22916bae092a0

lazka avatar May 22 '24 20:05 lazka