[Bug ipa/103230] New: ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'

2021-11-14 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103230

Bug ID: 103230
   Summary: ipa-modref-tree.h:550:33: runtime error: load of value
255, which is not a valid value for type 'bool'
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
Blocks: 63426
  Target Milestone: ---

Happens with UBSAN compiler for:

$ gcc gcc/testsuite/gcc.c-torture/execute/pr71494.c -O1  -flto
...
/home/marxin/Programming/gcc/gcc/ipa-modref-tree.h:550:33: runtime error: load
of value 255, which is not a valid value for type 'bool'
#0 0x18acc38 in modref_tree::merge(modref_tree*,
vec*, modref_parm_map*, bool)
/home/marxin/Programming/gcc/gcc/ipa-modref-tree.h:550
#1 0x188452c in modref_propagate_in_scc
/home/marxin/Programming/gcc/gcc/ipa-modref.c:4385
#2 0x188a2b7 in execute /home/marxin/Programming/gcc/gcc/ipa-modref.c:4932
#3 0x1f513bc in execute_one_pass(opt_pass*)
/home/marxin/Programming/gcc/gcc/passes.c:2567
#4 0x1f54a44 in execute_ipa_pass_list(opt_pass*)
/home/marxin/Programming/gcc/gcc/passes.c:2996
#5 0xb3bd3c in do_whole_program_analysis
/home/marxin/Programming/gcc/gcc/lto/lto.c:469
#6 0xb3c538 in lto_main() /home/marxin/Programming/gcc/gcc/lto/lto.c:637
#7 0x2417b3b in compile_file /home/marxin/Programming/gcc/gcc/toplev.c:452
#8 0x2422188 in do_compile /home/marxin/Programming/gcc/gcc/toplev.c:2156
#9 0x2422c03 in toplev::main(int, char**)
/home/marxin/Programming/gcc/gcc/toplev.c:2308
#10 0x6edfd90 in main /home/marxin/Programming/gcc/gcc/main.c:39
#11 0x76f1453f in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
#12 0x76f145eb in __libc_start_main_impl ../csu/libc-start.c:409
#13 0xaa3b74 in _start (/dev/shm/objdir2/gcc/lto1+0xaa3b74)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined

Re: [Bug ipa/103230] New: ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'

2021-11-14 Thread Jan Hubicka via Gcc-bugs
> Happens with UBSAN compiler for:
> 
> $ gcc gcc/testsuite/gcc.c-torture/execute/pr71494.c -O1  -flto
> ...
> /home/marxin/Programming/gcc/gcc/ipa-modref-tree.h:550:33: runtime error: load
> of value 255, which is not a valid value for type 'bool'
> #0 0x18acc38 in modref_tree::merge(modref_tree*,
> vec*, modref_parm_map*, bool)
> /home/marxin/Programming/gcc/gcc/ipa-modref-tree.h:550
> #1 0x188452c in modref_propagate_in_scc

At 4385 I have:
   changed |= cur_summary_lto->stores->merge
(callee_summary_lto->stores, &parm_map, &chain_map, !first);
 

parm-map is the vector, however there is no read of it.
There is bool which is relevant only when parm_index is not unknown, so
I suspect it may a full copy with uninitialized bool which would be
harmless. We had similar issues with asan before.

How do you build ubsan compiler?
Honza