[PATCH] PR driver/69779: fix bogus cleanup code used by libgccjit affecting s390x

Jeff Law law@redhat.com
Fri Feb 12 18:18:00 GMT 2016


On 02/12/2016 11:12 AM, David Malcolm wrote:

>
> The problem is that struct spec_list's "name" field is declared const:
>
>    const char *name;		/* name of the spec.  */
>
> and likewise for the "name" field within struct spec_list_1:
>
>    const char *const name;
>
> Some are statically allocated, others are dynamically allocated.
>
> If I convert them to:
>
>    char *name;		/* name of the spec.  */
>
> and:
>
>    char *const name;
I'm not suggesting you remove the const for thees things.

> It seems simpler to keep the "const" on those string fields, and cast
> it away when cleaning up the dynamically-allocated ones (as in the
> candidate patch).
Is it really necessary to cast it away to call free?  I suppose it is.

OK without the twiddle.

jeff



More information about the Gcc-patches mailing list