https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84947
Bug ID: 84947
Summary: UBSAN:
ipcp_bits_lattice::meet_with(generic_wide_int<fixed_wi
de_int_storage<192> >,
generic_wide_int<fixed_wide_int_storage<192> >,
unsigned int) ../../gcc/ipa-cp.c:1058
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jamborm at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
Following causes UBSAN:
$ cat a.c
int main() { foo(0); }
$ cat b.c
struct a {
} foo(struct a b) {
}
$ gcc -flto -O2 [ab].c
a.c: In function ‘main’:
a.c:1:14: warning: implicit declaration of function ‘foo’
[-Wimplicit-function-declaration]
int main() { foo(0); }
^~~
a.c:1:14: warning: type of ‘foo’ does not match original declaration
[-Wlto-type-mismatch]
int main() { foo(0); }
^
b.c:2:3: note: return value type mismatch
} foo(struct a b) {
^
b.c:2:3: note: type ‘struct a’ should match type ‘int’
b.c:2:3: note: ‘foo’ was previously declared here
../../gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for
64-bit type 'long unsigned int'
#0 0x37bd3d1 in sext_hwi ../../gcc/hwint.h:293
#1 0x37bd3d1 in
wi::binary_traits<generic_wide_int<fixed_wide_int_storage<192> >,
generic_wide_int<fixed_wide_int_storage<192> >,
wi::int_traits<generic_wide_int<fixed_wide_int_storage<192> >
>::precision_type, wi::int_traits<generic_wide_int<fixed_wide_int_storage<192>
> >::precision_type>::result_type
wi::sext<generic_wide_int<fixed_wide_int_storage<192> >
>(generic_wide_int<fixed_wide_int_storage<192> > const&, unsigned int)
../../gcc/wide-int.h:2133
#2 0x37bd3d1 in
ipcp_bits_lattice::meet_with(generic_wide_int<fixed_wide_int_storage<192> >,
generic_wide_int<fixed_wide_int_storage<192> >, unsigned int)
../../gcc/ipa-cp.c:1058
#3 0x37c3d07 in propagate_bits_across_jump_function(cgraph_edge*, int,
ipa_jump_func*, ipcp_bits_lattice*) ../../gcc/ipa-cp.c:1878
#4 0x37c5892 in propagate_constants_across_call ../../gcc/ipa-cp.c:2317
#5 0x37d8ca2 in propagate_constants_topo ../../gcc/ipa-cp.c:3224
#6 0x37d8ca2 in ipcp_propagate_stage ../../gcc/ipa-cp.c:3318
#7 0x37e28ee in ipcp_driver ../../gcc/ipa-cp.c:5044
#8 0x37e28ee in execute ../../gcc/ipa-cp.c:5138
#9 0x16690a0 in execute_one_pass(opt_pass*) ../../gcc/passes.c:2497
#10 0x166e35a in execute_ipa_pass_list(opt_pass*) ../../gcc/passes.c:2932
#11 0x6a22f8 in do_whole_program_analysis ../../gcc/lto/lto.c:3147
#12 0x6a22f8 in lto_main() ../../gcc/lto/lto.c:3368
#13 0x1a607ca in compile_file ../../gcc/toplev.c:455
#14 0x628cdc in do_compile ../../gcc/toplev.c:2132
#15 0x628cdc in toplev::main(int, char**) ../../gcc/toplev.c:2267
#16 0x62b76a in main ../../gcc/main.c:39
#17 0x7ffff5cafa86 in __libc_start_main (/lib64/libc.so.6+0x21a86)
#18 0x62b899 in _start
(/home/marxin/bin/gcc/lib/gcc/x86_64-pc-linux-gnu/8.0.1/lto1+0x62b899)