https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107387
Bug ID: 107387 Summary: gcc trunk -O2 crashes when enable UBSan Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch Target Milestone: --- % gcc-tk -v Using built-in specs. COLLECT_GCC=gcc-tk COLLECT_LTO_WRAPPER=/zdata/shaoli/compilers/ccbuilder-compilers/gcc-99da523359e9333555585484eb3b8f854a98f1b4/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --enable-languages=c,c++ --prefix=/zdata/shaoli/compilers/ccbuilder-compilers/gcc-99da523359e9333555585484eb3b8f854a98f1b4 Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221013 (experimental) (GCC) % % gcc-tk -fsanitize=undefined -O2 a.c a.c: In function ‘m’: a.c:8:59: warning: division by zero [-Wdiv-by-zero] 8 | static inline __attribute__((always_inline)) void m() { 0 / 0; } | ^ during GIMPLE pass: slp a.c: In function ‘p.isra’: a.c:31:7: internal compiler error: in to_sreal_scale, at profile-count.cc:339 31 | void *p() { | ^ 0x2059aee internal_error(char const*, ...) ???:0 0x99f3c4 fancy_abort(char const*, int, char const*) ???:0 0x1310657 vect_optimize_slp_pass::start_choosing_layouts() ???:0 0x13118af vect_optimize_slp_pass::run() ???:0 0x1319cd9 vect_slp_function(function*) ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. % % cat a.c int a, b, c, e, k; char *d; struct { short f; short g; } l; static int h = 1; static inline __attribute__((always_inline)) void m() { 0 / 0; } static int n() { return a && b && a < b ?: b; } static int *o(); static void *p(); static unsigned short q(int); void r() { p(); o(&a); m(); } int *o(int *s) { *s = n(); } unsigned short q(int s) { if (s) { int i = 0; for (; i < 7;) i = 7; k = n(); } } void *p() { int i, j; char *t[81]; for (; i < 8; i++) for (; j; j++) t[e] = d; q(h); if (c) l.g = l.f = 0; } % Compiler explorer: https://godbolt.org/z/qEWr71vbd