Bug 2342604

Summary: GCC 15: While compiling embree with tutorials, internal compiler error: Segmentation fault
Product: [Fedora] Fedora Reporter: Ben Beasley <code>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: dmalcolm, fweimer, jakub, jlaw, josmyers, jwakely, mcermak, mpolacek, msebor, nickc, nixuser, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-15.0.1-0.5.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-01 13:34:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2337588    
Attachments:
Description Flags
bvh_access.cpp.ii none

Description Ben Beasley 2025-01-28 16:11:33 UTC
With GCC 15, on aarch64 only, with the "tutorials" build conditional set in the embree package in Rawhide:

[ 73%] Building CXX object tutorials/quaternion_motion_blur/CMakeFiles/embree_quaternion_motion_blur.dir/quaternion_motion_blur.cpp.o
cd /builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/quaternion_motion_blur && /usr/bin/g++ -DEMBREE_TARGET_SSE2 -DIMGUI_DISABLE_SSE -DTASKING_TBB -DUSE_GLFW -I/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3 -I/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/kernels/../include -I/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/common/imgui/. -I/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/common/imgui/./backends -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wl,--as-needed -fsigned-char -flax-vector-conversions -Wall -Wformat -Wformat-security -Wno-class-memaccess -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -fsigned-char -fPIE -fPIC -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-aliasing -fno-tree-vectorize -D_FORTIFY_SOURCE=2  -fsigned-char -DNDEBUG -O3  -D__SSE__ -D__SSE2__ -MD -MT tutorials/quaternion_motion_blur/CMakeFiles/embree_quaternion_motion_blur.dir/quaternion_motion_blur.cpp.o -MF CMakeFiles/embree_quaternion_motion_blur.dir/quaternion_motion_blur.cpp.o.d -o CMakeFiles/embree_quaternion_motion_blur.dir/quaternion_motion_blur.cpp.o -c /builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/quaternion_motion_blur/quaternion_motion_blur.cpp
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | annobin: Generate final annotations
PLUGIN_START_UNIT                | annobin: Generate global annotations
PLUGIN_ALL_PASSES_START          | annobin: Generate per-function annotations
PLUGIN_ALL_PASSES_END            | annobin: Register per-function end symbols
during RTL pass: ldp_fusion
/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/bvh_access/bvh_access.cpp: In function ‘embree::print_bvh4_triangle4v(embree::NodeRefPtr<4>, unsigned long) [clone .constprop.3]’:
/builddir/build/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/bvh_access/bvh_access.cpp:176:3: internal compiler error: Segmentation fault
  176 |   }
      |   ^
Please submit a full bug report, with preprocessed source.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

This was the root cause of bug 2340123, but I am about to open a PR that will propose working around the FTBFS by not building the tutorials. Since merging that PR would close bug 2340123, I am opening this issue to track the actual GCC bug.

Reproducible: Always

Comment 1 Marek Polacek 2025-01-28 18:03:14 UTC
Reproduced with a cross:

$ ./cc1plus -quiet bvh_access.cpp.ii -O3 -flax-vector-conversions -Iinclude -fstack-protector-strong   -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -fsigned-char -flax-vector-conversions -Wall -Wformat -Wformat-security -Wno-class-memaccess -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -fsigned-char -fPIE -fPIC -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-aliasing -fno-tree-vectorize
during RTL pass: ldp_fusion
/root/rpmbuild/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/bvh_access/bvh_access.cpp: In function ‘void embree::print_bvh4_triangle4v(BVHN<4>::NodeRef, size_t)’:
/root/rpmbuild/BUILD/embree-4.3.3-build/embree-4.3.3/tutorials/bvh_access/bvh_access.cpp:176:3: internal compiler error: Segmentation fault
0x2332b01 internal_error(char const*, ...)
	/home/mpolacek/src/gcc/gcc/diagnostic-global-context.cc:517
0x1093e4f crash_signal
	/home/mpolacek/src/gcc/gcc/toplev.cc:322
0x7f00be1df04f ???
	/usr/src/debug/glibc-2.40-21.fc41.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x2191150 derived_iterator<rtl_ssa::use_info*, rtl_ssa::access_info* const*>::operator*() const
	/home/mpolacek/src/gcc/gcc/iterator-utils.h:68
0x2191150 bool rtl_ssa::restrict_movement_for_uses<rtl_ssa::ignore_changing_insns>(rtl_ssa::insn_range_info&, const_derived_container<rtl_ssa::use_info*, array_slice<rtl_ssa::access_info* const> >, rtl_ssa::ignore_changing_insns)
	/home/mpolacek/src/gcc/gcc/rtl-ssa/movement.h:285
0x2191150 bool rtl_ssa::restrict_movement<rtl_ssa::ignore_changing_insns>(rtl_ssa::insn_change&, rtl_ssa::ignore_changing_insns)
	/home/mpolacek/src/gcc/gcc/rtl-ssa/change-utils.h:64
0x2199e37 pair_fusion_bb_info::fuse_pair(bool, unsigned int, int, rtl_ssa::insn_info*, rtl_ssa::insn_info*, base_cand&, rtl_ssa::insn_range_info const&)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:1965
0x219d97f pair_fusion_bb_info::try_fuse_pair(bool, unsigned int, rtl_ssa::insn_info*, rtl_ssa::insn_info*)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:2805
0x219de4d pair_fusion_bb_info::merge_pairs(std::__cxx11::list<rtl_ssa::insn_info*, std::allocator<rtl_ssa::insn_info*> >&, std::__cxx11::list<rtl_ssa::insn_info*, std::allocator<rtl_ssa::insn_info*> >&, bool, unsigned int)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:2894
0x219e423 pair_fusion_bb_info::transform_for_base(int, access_group&)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:2927
0x219e423 void pair_fusion_bb_info::traverse_base_map<ordered_hash_map<pair_hash<tree_operand_hash, int_hash<int, -1, -2> >, access_group, simple_hashmap_traits<default_hash_traits<pair_hash<tree_operand_hash, int_hash<int, -1, -2> > >, access_group> > >(ordered_hash_map<pair_hash<tree_operand_hash, int_hash<int, -1, -2> >, access_group, simple_hashmap_traits<default_hash_traits<pair_hash<tree_operand_hash, int_hash<int, -1, -2> > >, access_group> >&)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:2975
0x2193567 pair_fusion_bb_info::transform()
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:2982
0x2193567 pair_fusion::process_block(rtl_ssa::bb_info*)
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:3110
0x2193a3a pair_fusion::run()
	/home/mpolacek/src/gcc/gcc/pair-fusion.cc:133
0x1608b22 execute
	/home/mpolacek/src/gcc/gcc/config/aarch64/aarch64-ldp-fusion.cc:303

Comment 2 Marek Polacek 2025-01-28 18:05:11 UTC
I think it's <https://gcc.gnu.org/PR118320>.

Comment 3 Jakub Jelinek 2025-01-29 09:05:58 UTC
Do you have preprocessed source for this?
I think the PR118320 testcase has the disadvantage that it needs -fno-tree-sra, if we have something without it, that would be better.

Comment 4 Marek Polacek 2025-01-29 14:28:02 UTC
Created attachment 2074362 [details]
bvh_access.cpp.ii

Here it is.  Unfortunately, it's huge :(.