Ping. On Mon, Sep 16, 2013 at 05:49:55PM +0200, Marek Polacek wrote: > This patch amends the chunk of code where we are determining the > type name; I haven't consider that IDENTIFIER_NODEs require special > handling, since we need to omit the DECL_NAME. I had something similar > in http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00917.html patch, but > there I had a thinko: I need to check that TYPE_NAME is non-NULL first. > > Regtested/ran bootstrap-ubsan on x86_64-linux. > > Ok for trunk? > > 2013-09-16 Marek Polacek <pola...@redhat.com> > > PR sanitizer/58420 > * ubsan.c (ubsan_type_descriptor): Handle IDENTIFIER_NODEs > when determining the type name. > > --- gcc/ubsan.c.mp 2013-09-16 14:22:07.195918175 +0200 > +++ gcc/ubsan.c 2013-09-16 14:22:10.503929477 +0200 > @@ -260,11 +260,18 @@ ubsan_type_descriptor (tree type) > unsigned short tkind, tinfo; > > /* At least for INTEGER_TYPE/REAL_TYPE/COMPLEX_TYPE, this should work. > - ??? For e.g. type_unsigned_for (type), the TYPE_NAME would be NULL. */ > + For e.g. type_unsigned_for (type) or bit-fields, the TYPE_NAME > + would be NULL. */ > if (TYPE_NAME (type) != NULL) > - tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); > + { > + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) > + tname = IDENTIFIER_POINTER (TYPE_NAME (type)); > + else > + tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); > + } > else > tname = "<unknown>"; > + > if (TREE_CODE (type) == INTEGER_TYPE) > { > /* For INTEGER_TYPE, this is 0x0000. */ > > Marek
Marek