On 11/14/14 10:52, Marek Polacek wrote:
We ICEd when dumping the IPA symbol table when -fsanitize=undefined
and -fdump-ipa-* options were enabled on every testcase where we
sanitized something and thus internal ubsan data have been created.
The problem was that the C++ printer expects a decl as a TYPE_NAME,
but we were sticking an identifier node into the TYPE_NAME.
Fixed by creating a proper TYPE_DECL and then putting this TYPE_DECL
into TYPE_NAME and TYPE_STUB_DECL.  Ditto for asan.c.

While at it, I noticed that we don't cache ubsan_type_descriptor_type,
oops.  So I've fixed that as well.

Bootstrapped/regtested on power8-linux, ok for trunk?

2014-11-14  Marek Polacek  <pola...@redhat.com>

        PR sanitizer/63866
        * asan.c (asan_global_struct): Create a TYPE_DECL for "__asan_global",
        put it into TYPE_NAME and TYPE_STUB_DECL.
        * ubsan.c (ubsan_type_descriptor_type): New variable.
        Function renamed to ...
        (ubsan_get_type_descriptor_type): ... this.  Cache
        return value in ubsan_type_descriptor_type variable.
        Create a TYPE_DECL for "__ubsan_type_descriptor", put it into
        TYPE_NAME and TYPE_STUB_DECL.
        (ubsan_get_source_location_type): Create a TYPE_DECL for
        "__ubsan_source_location", put it into TYPE_NAME and TYPE_STUB_DECL.
        (ubsan_type_descriptor, ubsan_create_data): Call
        ubsan_get_type_descriptor_type instead of ubsan_type_descriptor_type.
        Create a TYPE_DECL for name, put it into TYPE_NAME and TYPE_STUB_DECL.

        * c-c++-common/ubsan/pr63866.c: New test.
OK.

Jeff

Reply via email to