https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101249
Bug ID: 101249 Summary: ICE: Segmentation fault with "-O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv" Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: suochenyao at 163 dot com Target Milestone: --- ******************************************************************************* OS and Platform: CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux ******************************************************************************* Program: unsigned a[]; char b=0, c=0; int d=0; void e() { int f, g; for (; b; b++) { c = 0; for (; c <= 8; c++) { int *h = &f; *h |= a[c]; g = *h = a[c]; } d = g; } } int main() {} ******************************************************************************* gcc version: $ gcc -v Using built-in specs. COLLECT_GCC=/data/bin/gcc-dev/bin/gcc COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib --enable-languages=c,c++ Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210628 (experimental) (GCC) git version: 7c6b354b92b38f31cd2399fbdbc9d6f837881480 ******************************************************************************* Command Lines: $ gcc -O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv a.c a.c:1:10: warning: array āaā assumed to have one element 1 | unsigned a[]; | ^ a.c: In function āeā: a.c:10:14: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations] 10 | *h |= a[c]; | ~^~~ a.c:8:14: note: within this loop 8 | for (; c <= 8; c++) { | ~~^~~~ during GIMPLE pass: slp a.c:4:6: internal compiler error: Segmentation fault 4 | void e() { | ^ 0xe3a99f crash_signal ../../gcc/toplev.c:328 0x10e1b47 vec<_stmt_vec_info*, va_heap, vl_ptr>::iterate(unsigned int, _stmt_vec_info**) const ../../gcc/vec.h:1697 0x10e1b47 vect_optimize_slp(vec_info*) ../../gcc/tree-vect-slp.c:3992 0x10e9c5c vect_optimize_slp(vec_info*) ../../gcc/vec.h:1448 0x10e9c5c vect_slp_analyze_bb_1 ../../gcc/tree-vect-slp.c:5621 0x10e9c5c vect_slp_region ../../gcc/tree-vect-slp.c:5708 0x10eb2c8 vect_slp_bbs ../../gcc/tree-vect-slp.c:5858 0x10eb6c4 vect_slp_function(function*) ../../gcc/tree-vect-slp.c:5944 0x10f1712 execute ../../gcc/tree-vectorizer.c:1445 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.