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

--- Comment #8 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Created attachment 61944
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61944&action=edit
Reduced reproducer

Shorter reproducer. The miscompiled function is jl_emit_native_impl(), which is
down to 30 lines of code.

g++ -mprefer-vector-width=256 -std=c++17 -fno-exceptions -funwind-tables
-fno-rtti -Llib -Llib/julia -lLLVM -ljulia-internal -ljulia -Wl,-rpath lib
-Wl,-rpath lib/julia -O2 -DMISCOMPILE=1 repro.cpp -w

With -DMISCOMPILE=1 the function is compiled with -ftree-partial-pre and the
generated executable calls __builtin_trap(). Without it, it compiles fine.

Use of -fdump-tree-all shows that it's in the pre pass that the good and bad
compilations start to diverge, but I don't know what is legitimate and what is
wrong. I hope the reduced test case helps someone else finish debugging.

Reply via email to