This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ubsan ICE (PR sanitizer/60569)
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Mar 2014 12:30:14 +0100
- Subject: Re: [PATCH] Fix ubsan ICE (PR sanitizer/60569)
- Authentication-results: sourceware.org; auth=none
- References: <20140319111357 dot GI6523 at redhat dot com> <20140319111719 dot GD22862 at tucnak dot redhat dot com>
On Wed, Mar 19, 2014 at 12:17:19PM +0100, Jakub Jelinek wrote:
> On Wed, Mar 19, 2014 at 12:13:57PM +0100, Marek Polacek wrote:
> > Apparently with LTO we can get a TYPE_NAME without a DECL_NAME,
> > so check that it exists before accessing it.
> > Note that the test has to be run; only compiling wasn't enough
> > to provoke the ICE.
>
> ?? Shouldn't // { dg-do link } be sufficient?
Ah, forgot about that, it is sufficient. Ok with dg-do link instead
of dg-do run?
> > --- gcc/ubsan.c
> > +++ gcc/ubsan.c
> > @@ -318,7 +318,7 @@ ubsan_type_descriptor (tree type, bool want_pointer_type_p)
> > {
> > if (TREE_CODE (TYPE_NAME (type2)) == IDENTIFIER_NODE)
> > tname = IDENTIFIER_POINTER (TYPE_NAME (type2));
> > - else
> > + else if (DECL_NAME (TYPE_NAME (type2)) != NULL)
> > tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type2)));
> > }
>
> This looks good to me.
Thanks.
Marek