Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE in gcc 14.1.0 trying to compile emacs from source #20879

Closed
2 of 7 tasks
cyrilarnould opened this issue May 12, 2024 · 6 comments · Fixed by #20884
Closed
2 of 7 tasks

ICE in gcc 14.1.0 trying to compile emacs from source #20879

cyrilarnould opened this issue May 12, 2024 · 6 comments · Fixed by #20884

Comments

@cyrilarnould
Copy link

Description / Steps to reproduce the issue

Trying to compile emacs from source, I get an internal compilation error. I do need to patch src/syswait.c to forcibly include <sys/wait.h>, as I get an implicit function declaration error otherwise (I've reported this upstream). The (hacky) patch:

syswait.patch

The steps to reproduce:

git clone https://git.savannah.gnu.org/git/emacs.git
cd emacs
git checkout emacs-29.3
git apply syswait.patch
./autogen.sh
./configure
make

Contrary to #20861 (which seems similar), I'm not compiling with -fno-omit-frame-pointer, just the default CFLAGS -g3 -O2 -gdwarf-2. OTOH, the issue does seem to go away when compiling with -O1.

Expected behavior

No ICE

Actual behavior

  CC       thread.o
during RTL pass: dwarf2
thread.c: In function 'Fthread_yield':
thread.c:725:1: internal compiler error: in dwarf2out_frame_debug_expr, at dwarf2cfi.cc:2112
  725 | }
      | ^
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <https://github.com/msys2/MINGW-packages/issues> for instructions.

Verification

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANG32
  • CLANGARM64

Are you willing to submit a PR?

Sure

@lazka
Copy link
Member

lazka commented May 12, 2024

Thanks. Did this work before (with GCC 13.2.0)?

@lazka
Copy link
Member

lazka commented May 12, 2024

Your example also fails like the other issues if the dwarf flags are not given, so it might be related at least.

I'm going to reduce both cases and file them upstream.

@lazka lazka added the GCC label May 12, 2024
@cyrilarnould
Copy link
Author

Thanks. Did this work before (with GCC 13.2.0)?

Haven't personally tested it, but I guess the current mingw-w64-emacs release (also 29.3) is probably still built with GCC 13.2.

I'm going to reduce both cases and file them upstream.

Thanks!

@cyrilarnould
Copy link
Author

cyrilarnould commented May 12, 2024

I saw that -fno-fold-mem-offsets is suggested in your ticket as a workaround for the other issues, and it seems to solve the emacs compilation as well. I want to take another look at the -D_FORTIFY_SOURCE and -fno-optimize-sibling-calls that were added to mingw-w64-emacs in the past before creating a PR though.

Also, the sys/wait.h issue can be fixed using -Wno-error=implicit-function-declaration.

@lazka
Copy link
Member

lazka commented May 12, 2024

Reduced to this in the meantime:

// gcc -c -O2 repro.c -> internal compiler error: in seh_cfa_offset
// gcc -c -g3 -O2 -gdwarf-2 repro.c -> internal compiler error: in dwarf2out_frame_debug_expr
void a() {
    __builtin_unwind_init();
}

@cyrilarnould
Copy link
Author

Ah, I guess there's no need to add the -fno-fold-mem-offsets flag if the upstream patch works, so we'd only need to add -Wno-error=implicit-function-declaration.

In the meantime, I've confirmed that #17550 and #17343 still are a problem, so the -D_FORTIFY_SOURCE and -fno-optimize-sibling-calls modifications are still necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants