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

            Bug ID: 125718
           Summary: ICE in block_label / patch_jump_insn (cfgrtl.cc) with
                    -O3 -fPIC -fnon-call-exceptions -fno-strict-aliasing
                    on x86_64 (C++)
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, needs-bisection
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: am at 6it dot dev
  Target Milestone: ---

Created attachment 64693
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64693&action=edit
Preprocessed source (.ii) reproducing the ICE

GCC 15.2.0 and the current releases/gcc-15 snapshot
(gcc-15-20260529, revision 9c3d2b6d54f3a488be1ffe3886900ab041df3e30,
BASE-VER 15.2.1) both ICE when compiling code from upstream
assimp v6.0.5 with the flag combination
-O3 -fPIC -fno-strict-aliasing -fnon-call-exceptions -std=c++20.

Target: x86_64-linux-gnu
Compiler: built from releases/gcc-15 snapshot 2026-05-29
          (BASE-VER 15.2.1, revision 9c3d2b6d54f3a488be1ffe3886900ab041df3e30)
Also reproduces on g++ 15.2.0.

Minimal reproducer command (preprocessed source attached):

  g++ -O3 -fPIC -fno-strict-aliasing -fnon-call-exceptions -std=c++20 \
      -c repro_upstream.ii

------------------------------------------------------------------
Crash output (snapshot build, with debug info):
------------------------------------------------------------------

during RTL pass: jump
/assimp/code/AssetLib/X3D/X3DGeoHelper.cpp: In static member function
'static void Assimp::X3DGeoHelper::add_tex_coord(aiMesh&, const
std::vector<int>&,
const std::vector<int>&, const std::__cxx11::list<aiVector2t<float> >&)':
/assimp/code/AssetLib/X3D/X3DGeoHelper.cpp:522:1: internal compiler error:
Segmentation fault
  522 | }
      | ^
0x2257886 internal_error(char const*, ...)
        /src/gcc/diagnostic-global-context.cc:517
0xf967b3 crash_signal
        /src/gcc/toplev.cc:322
0xace9c5 block_label(basic_block_def*)
        /src/gcc/cfgrtl.cc:1014
0xace9c5 patch_jump_insn
        /src/gcc/cfgrtl.cc:1301
0xaceaee redirect_branch_edge
        /src/gcc/cfgrtl.cc:1330
0xad04c2 cfg_layout_redirect_edge_and_branch
        /src/gcc/cfgrtl.cc:4734
0xabaced redirect_edge_and_branch(edge_def*, basic_block_def*)
        /src/gcc/cfghooks.cc:391
0x1f5b1bc try_forward_edges
        /src/gcc/cfgcleanup.cc:561
0x1f5b1bc try_optimize_cfg
        /src/gcc/cfgcleanup.cc:2931
0x1f5b1bc cleanup_cfg(int)
        /src/gcc/cfgcleanup.cc:3143
0x1f5d80e execute
        /src/gcc/cfgcleanup.cc:3240

------------------------------------------------------------------
Flag minimization:
------------------------------------------------------------------

-fPIC, -fnon-call-exceptions, and -fno-strict-aliasing
must all be set; removing any one of them at -O3 -std=c++20 eliminates
the crash.

------------------------------------------------------------------
Source origin:
------------------------------------------------------------------

File: code/AssetLib/X3D/X3DGeoHelper.cpp (unmodified)
From: upstream assimp v6.0.5
      https://github.com/assimp/assimp
      BSD 3-Clause License

Reply via email to