https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78555

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
For example:

markus@x4 ~ % cat bench.ii
struct A {
  enum { __value };
};
template <int, typename _II, typename _OI> _OI __copy_move_a2(_II, _OI);
template <typename _II, typename _OI> void copy(_II, _II, _OI p3) {
  __copy_move_a2<A::__value>(0, p3);
}
struct B {
  template <typename> using __iter = B;
  B(const __iter<int> &);
};
struct C {
  C(int, int);
  B m_fn1();
};
void run(void(double *, double *));
void deque_test(double *p1, double *p2) {
  C a(0, 0);
  B b = a.m_fn1();
  copy(p1, p2, b);
}
int main() { run(deque_test); }

markus@x4 ~ % UBSAN_OPTIONS=print_stacktrace=1
/var/tmp/gcc_ubsan/usr/local/bin/g++ -c -O2 ~/bench.ii


../../gcc/gcc/sreal.c:232:20: runtime error: left shift of negative value
-1744830464
    #0 0x24828f0 in sreal::operator/(sreal const&) const
../../gcc/gcc/sreal.c:232
    #1 0x402f3df in edge_badness ../../gcc/gcc/ipa-inline.c:1156
    #2 0x40310dd in update_edge_key ../../gcc/gcc/ipa-inline.c:1222
    #3 0x403a937 in inline_small_functions ../../gcc/gcc/ipa-inline.c:1824
    #4 0x403a937 in ipa_inline ../../gcc/gcc/ipa-inline.c:2434
    #5 0x403a937 in execute ../../gcc/gcc/ipa-inline.c:2845
    #6 0x210fc68 in execute_one_pass(opt_pass*) ../../gcc/gcc/passes.c:2370
    #7 0x2113a4a in execute_ipa_pass_list(opt_pass*)
../../gcc/gcc/passes.c:2805
    #8 0x142e013 in ipa_passes ../../gcc/gcc/cgraphunit.c:2339
    #9 0x142e013 in symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2425
    #10 0x1438457 in symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2587
    #11 0x1438457 in symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2584
    #12 0x24f39c0 in compile_file ../../gcc/gcc/toplev.c:488
    #13 0x64bea4 in do_compile ../../gcc/gcc/toplev.c:1983
    #14 0x64bea4 in toplev::main(int, char**) ../../gcc/gcc/toplev.c:2117
    #15 0x64e4d6 in main ../../gcc/gcc/main.c:39
    #16 0x7f15fa124310 in __libc_start_main ../csu/libc-start.c:286
    #17 0x64e8e9 in _start
(/var/tmp/gcc_ubsan/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus+0x64e8e9)

Reply via email to