https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88215
Bug ID: 88215 Summary: UBSAN: Internal compiler error with attribute(unused) Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: orgads at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- > cat err.cpp void foo() { unsigned a = 2, __attribute__ ((unused)) b = 1; unsigned f = a/b; } > g++ -fsanitize=undefined -w -O0 -c err.cpp err.cpp: In function 'void foo()': err.cpp:4:20: internal compiler error: in ubsan_instrument_division, at c-family/c-ubsan.c:48 unsigned f = a/b; It doesn't happen if the variable is declared separately: unsigned __attribute__ ((unused)) b = 1; or __attribute__ ((unused)) unsigned b = 1; Looks similar to bug 80348.