[PATCH] Fix ubsan ICE (PR sanitizer/60569)
Jakub Jelinek
jakub@redhat.com
Wed Mar 19 12:07:00 GMT 2014
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?
> --- 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.
Jakub
More information about the Gcc-patches
mailing list