https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85029
Bug ID: 85029 Summary: -fsanitize=undefined internal compiler error: in maybe_optimize_ubsan_ptr_ifn, at sanopt.c:493 Product: gcc Version: 8.0.1 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at oracle 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, webrown.cpp at gmail dot com Target Milestone: --- Input: struct b { virtual b c(); int e; } register a; int d(...) { return d(a); } Output: $ cc1plus -O1 -fsanitize=undefined b::b() b::b() b::b() int d(...) constexpr b::b(const b&) constexpr b::b(const b&) constexpr b::b(const b&) void __static_initialization_and_destruction_0(int, int) void _GLOBAL__sub_I_a() Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> <visibility> <build_ssa_passes> <opt_local_passes> <targetclone> <free-fnsummary> <whole-program> <profile_estimate> <fnsummary> <inline> <pure-const> <free-fnsummary> <static-var> <single-use> <comdats>Assembling functions: <materialize-all-clones> <simdclone> int d(...)during GIMPLE pass: sanopt <stdin>: In function 'int d(...)': <stdin>:6:5: internal compiler error: in maybe_optimize_ubsan_ptr_ifn, at sanopt.c:493 0x323c8df maybe_optimize_ubsan_ptr_ifn /home/vegard/git/gcc/gcc/sanopt.c:493 0x323c8df sanopt_optimize_walker /home/vegard/git/gcc/gcc/sanopt.c:826 0x323393a sanopt_optimize_walker /home/vegard/git/gcc/gcc/sanopt.c:873 0x3246393 sanopt_optimize /home/vegard/git/gcc/gcc/sanopt.c:897 0x3246393 execute /home/vegard/git/gcc/gcc/sanopt.c:1260 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. Version: GNU C++14 (GCC) version 8.0.1 20180306 (experimental) (x86_64-pc-linux-gnu) 7.3.0 says: <source>: In function 'int d(...)': <source>:4:12: error: register name not specified for 'a' } register a; ^ Compiler returned: 1 clang says (with or without -std=c++14): <source>:4:3: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] } register a; ^~~~~~~~~ <source>:4:12: error: illegal storage class on file-scoped variable } register a; ^ 1 warning and 1 error generated. Compiler returned: 1