This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]