public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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  8:55 marxin at gcc dot gnu.org
  2021-11-14  8:56 ` [Bug ipa/103230] " marxin at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-14  8:55 UTC (permalink / raw)
  To: 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<tree_node*>::merge(modref_tree<tree_node*>*,
vec<modref_parm_map, va_heap, vl_ptr>*, 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 0x7ffff6f1453f in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
    #12 0x7ffff6f145eb 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
@ 2021-11-14  8:56 ` marxin at gcc dot gnu.org
  2021-11-14  9:21 ` [Bug ipa/103230] New: " Jan Hubicka
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-14  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |12.0
           Priority|P3                          |P1
   Last reconfirmed|                            |2021-11-14
   Target Milestone|---                         |12.0
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 14+ messages in thread

* 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  8:55 [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' marxin at gcc dot gnu.org
  2021-11-14  8:56 ` [Bug ipa/103230] " marxin at gcc dot gnu.org
@ 2021-11-14  9:21 ` Jan Hubicka
  2021-11-14  9:21 ` [Bug ipa/103230] " hubicka at kam dot mff.cuni.cz
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Jan Hubicka @ 2021-11-14  9:21 UTC (permalink / raw)
  To: marxin at gcc dot gnu.org; +Cc: 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<tree_node*>::merge(modref_tree<tree_node*>*,
> vec<modref_parm_map, va_heap, vl_ptr>*, 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
  2021-11-14  8:56 ` [Bug ipa/103230] " marxin at gcc dot gnu.org
  2021-11-14  9:21 ` [Bug ipa/103230] New: " Jan Hubicka
@ 2021-11-14  9:21 ` hubicka at kam dot mff.cuni.cz
  2021-11-14  9:26 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: hubicka at kam dot mff.cuni.cz @ 2021-11-14  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from hubicka at kam dot mff.cuni.cz ---
> 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<tree_node*>::merge(modref_tree<tree_node*>*,
> vec<modref_parm_map, va_heap, vl_ptr>*, 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-11-14  9:21 ` [Bug ipa/103230] " hubicka at kam dot mff.cuni.cz
@ 2021-11-14  9:26 ` marxin at gcc dot gnu.org
  2021-11-14  9:47   ` Jan Hubicka
  2021-11-14  9:47 ` hubicka at kam dot mff.cuni.cz
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-14  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
> How do you build ubsan compiler?

F="-O0 -g -fsanitize=undefined" ; make -j16 all-host -k CFLAGS="$F"
CXXFLAGS="$F"  LDFLAGS="$F"

is the fastest approach.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  9:26 ` marxin at gcc dot gnu.org
@ 2021-11-14  9:47   ` Jan Hubicka
  0 siblings, 0 replies; 14+ messages in thread
From: Jan Hubicka @ 2021-11-14  9:47 UTC (permalink / raw)
  To: marxin at gcc dot gnu.org; +Cc: gcc-bugs

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103230
> 
> --- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
> > How do you build ubsan compiler?
> 
> F="-O0 -g -fsanitize=undefined" ; make -j16 all-host -k CFLAGS="$F"
> CXXFLAGS="$F"  LDFLAGS="$F"
> 
> is the fastest approach.
Thanks, it is similar to what I tried.  I guess there should be no ";"
but yet it leds to misconfigured libiberty for me on kunlun.  I will
look into that.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-11-14  9:26 ` marxin at gcc dot gnu.org
@ 2021-11-14  9:47 ` hubicka at kam dot mff.cuni.cz
  2021-11-14 10:01 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: hubicka at kam dot mff.cuni.cz @ 2021-11-14  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from hubicka at kam dot mff.cuni.cz ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103230
> 
> --- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
> > How do you build ubsan compiler?
> 
> F="-O0 -g -fsanitize=undefined" ; make -j16 all-host -k CFLAGS="$F"
> CXXFLAGS="$F"  LDFLAGS="$F"
> 
> is the fastest approach.
Thanks, it is similar to what I tried.  I guess there should be no ";"
but yet it leds to misconfigured libiberty for me on kunlun.  I will
look into that.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-11-14  9:47 ` hubicka at kam dot mff.cuni.cz
@ 2021-11-14 10:01 ` marxin at gcc dot gnu.org
  2021-11-14 10:04 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-14 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to hubicka from comment #3)
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103230
> > 
> > --- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
> > > How do you build ubsan compiler?
> > 
> > F="-O0 -g -fsanitize=undefined" ; make -j16 all-host -k CFLAGS="$F"
> > CXXFLAGS="$F"  LDFLAGS="$F"
> > 
> > is the fastest approach.
> Thanks, it is similar to what I tried.  I guess there should be no ";"
> but yet it leds to misconfigured libiberty for me on kunlun.  I will
> look into that.

Note that kunlun may have an old system GCC compiler.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-11-14 10:01 ` marxin at gcc dot gnu.org
@ 2021-11-14 10:04 ` marxin at gcc dot gnu.org
  2021-11-16  8:46 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-14 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
The canonical approach would be using config/bootstrap-ubsan.mk config file.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-11-14 10:04 ` marxin at gcc dot gnu.org
@ 2021-11-16  8:46 ` marxin at gcc dot gnu.org
  2021-11-18  9:30 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-16  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Still reproduces with the current master:
g:e69b7c5779863469479698f863ab25e0d9b4586e.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-11-16  8:46 ` marxin at gcc dot gnu.org
@ 2021-11-18  9:30 ` pinskia at gcc dot gnu.org
  2021-11-18 12:12 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-18  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think it is changed that is being read here.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-11-18  9:30 ` pinskia at gcc dot gnu.org
@ 2021-11-18 12:12 ` marxin at gcc dot gnu.org
  2021-11-19 11:33 ` cvs-commit at gcc dot gnu.org
  2021-11-19 11:34 ` marxin at gcc dot gnu.org
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-18 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
I've got a patch candidate for it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-11-18 12:12 ` marxin at gcc dot gnu.org
@ 2021-11-19 11:33 ` cvs-commit at gcc dot gnu.org
  2021-11-19 11:34 ` marxin at gcc dot gnu.org
  11 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-19 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:74a4ece02df1b1b6f396fd0e24dbbf8b0897858a

commit r12-5399-g74a4ece02df1b1b6f396fd0e24dbbf8b0897858a
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Nov 18 13:14:25 2021 +0100

    Fix IPA modref ubsan.

    modref_tree<tree_node*>::merge(modref_tree<tree_node*>*,
vec<modref_parm_map, va_heap, vl_ptr>*, modref_parm_map*, bool)

    is called with modref_parm_map chain_map;

    The variable has uninitialized m.parm_offset_known and it is accessed
    here:

    gcc/ipa-modref-tree.h:572 a.parm_offset_known &= m.parm_offset_known;

            PR ipa/103230

    gcc/ChangeLog:

            * ipa-modref-tree.h (struct modref_parm_map): Add default
            constructor.
            * ipa-modref.c (ipa_merge_modref_summary_after_inlining): Use it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/103230] ipa-modref-tree.h:550:33: runtime error: load of value 255, which is not a valid value for type 'bool'
  2021-11-14  8:55 [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' marxin at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-11-19 11:33 ` cvs-commit at gcc dot gnu.org
@ 2021-11-19 11:34 ` marxin at gcc dot gnu.org
  11 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-19 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-11-19 11:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-14  8:55 [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' marxin at gcc dot gnu.org
2021-11-14  8:56 ` [Bug ipa/103230] " marxin at gcc dot gnu.org
2021-11-14  9:21 ` [Bug ipa/103230] New: " Jan Hubicka
2021-11-14  9:21 ` [Bug ipa/103230] " hubicka at kam dot mff.cuni.cz
2021-11-14  9:26 ` marxin at gcc dot gnu.org
2021-11-14  9:47   ` Jan Hubicka
2021-11-14  9:47 ` hubicka at kam dot mff.cuni.cz
2021-11-14 10:01 ` marxin at gcc dot gnu.org
2021-11-14 10:04 ` marxin at gcc dot gnu.org
2021-11-16  8:46 ` marxin at gcc dot gnu.org
2021-11-18  9:30 ` pinskia at gcc dot gnu.org
2021-11-18 12:12 ` marxin at gcc dot gnu.org
2021-11-19 11:33 ` cvs-commit at gcc dot gnu.org
2021-11-19 11:34 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).