https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78555
--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- markus@x4 ~ % cat real.ii class A { int N; static const int D = 1 << 31; int &m_fn1() const; }; int &A::m_fn1() const { int a((double)N / D); } markus@x4 ~ % UBSAN_OPTIONS=print_stacktrace=1 /var/tmp/gcc_ubsan/usr/local/bin/g++ -c -O2 real.ii ../../gcc/gcc/real.c:2890:25: runtime error: left shift of negative value -30 #0 0x21d4a5a in real_hash(real_value const*) ../../gcc/gcc/real.c:2890 #1 0x30050c1 in inchash::add_expr(tree_node const*, inchash::hash&, unsigned int) ../../gcc/gcc/tree.c:7805 #2 0x2c03287 in vn_nary_op_compute_hash ../../gcc/gcc/tree-ssa-sccvn.c:2594 #3 0x2c16f02 in vn_nary_op_lookup_1 ../../gcc/gcc/tree-ssa-sccvn.c:2726 #4 0x2c1737b in vn_nary_op_lookup_stmt(gimple*, vn_nary_op_s**) ../../gcc/gcc/tree-ssa-sccvn.c:2783 #5 0x2c25e07 in visit_nary_op ../../gcc/gcc/tree-ssa-sccvn.c:3457 #6 0x2c25e07 in visit_use ../../gcc/gcc/tree-ssa-sccvn.c:3894 #7 0x2c2c278 in process_scc ../../gcc/gcc/tree-ssa-sccvn.c:4128 #8 0x2c2c278 in extract_and_process_scc_for_name ../../gcc/gcc/tree-ssa-sccvn.c:4215 #9 0x2c2c278 in DFS ../../gcc/gcc/tree-ssa-sccvn.c:4267 #10 0x2c2eaa8 in sccvn_dom_walker::before_dom_children(basic_block_def*) ../../gcc/gcc/tree-ssa-sccvn.c:4733 #11 0x3e69c15 in dom_walker::walk(basic_block_def*) ../../gcc/gcc/domwalk.c:265 #12 0x2c38155 in run_scc_vn(vn_lookup_kind) ../../gcc/gcc/tree-ssa-sccvn.c:4844 #13 0x2b63d54 in execute ../../gcc/gcc/tree-ssa-pre.c:5151 #14 0x210fc68 in execute_one_pass(opt_pass*) ../../gcc/gcc/passes.c:2370 #15 0x2111afb in execute_pass_list_1 ../../gcc/gcc/passes.c:2459 #16 0x2111b24 in execute_pass_list_1 ../../gcc/gcc/passes.c:2460 #17 0x2111bb4 in execute_pass_list(function*, opt_pass*) ../../gcc/gcc/passes.c:2470 #18 0x210c885 in do_per_function_toporder(void (*)(function*, void*), void*) ../../gcc/gcc/passes.c:1729 #19 0x2113aef in execute_ipa_pass_list(opt_pass*) ../../gcc/gcc/passes.c:2812 #20 0x142e494 in ipa_passes ../../gcc/gcc/cgraphunit.c:2286 #21 0x142e494 in symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2425 #22 0x1438457 in symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2587 #23 0x1438457 in symbol_table::finalize_compilation_unit() ../../gcc/gcc/cgraphunit.c:2584 #24 0x24f39c0 in compile_file ../../gcc/gcc/toplev.c:488 #25 0x64bea4 in do_compile ../../gcc/gcc/toplev.c:1983 #26 0x64bea4 in toplev::main(int, char**) ../../gcc/gcc/toplev.c:2117 #27 0x64e4d6 in main ../../gcc/gcc/main.c:39 #28 0x7f7311ca0310 in __libc_start_main ../csu/libc-start.c:286 #29 0x64e8e9 in _start (/var/tmp/gcc_ubsan/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus+0x64e8e9)