[PATCH] don't trim empty string initializers for pointers (PR 90947)
Jason Merrill
jason@redhat.com
Sun Jun 23 03:37:00 GMT 2019
On 6/21/19 8:05 PM, Martin Sebor wrote:
> The solution we implemented in GCC 9 to get the mangling of
> non-type template arguments of class types containing array
> members consistent regardless of the form of their
> initialization introduced a couple of bugs. One of these
> is the subject of this patch. The bug results in stripping
> trailing initializers for array elements that involve the empty
> string such as in here:
>
> Â void f (void)
> Â {
> Â Â Â const char* a[1][1] = { "" };
> Â Â Â if (!a[0][0])
> Â Â Â Â Â __builtin_abort ();
> Â }
>
> The problem is caused by relying on initializer_zerop() that
> returns true for the empty string regardless of whether it's
> used to initialize an array or a pointer (the function doesn't
> know what the initializer is being used for).
Why doesn't the existing POINTER_TYPE_P check handle this? It's clearly
intended to.
Jason
More information about the Gcc-patches
mailing list