This is the mail archive of the 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] fix wrong gimple code with ptr to forward vla

Olivier Hainque wrote:

The attached patch fixes a problem whereby wrong gimple code is
emitted for a construct involving a pointer to a forward type which
later completion involves a variable length array.


	 Note that forcing gimplification of bounds/sizes for a named type
	 here would not only be pointless.  It would actually be incorrect
	 because they might depend on variables only initialized after this
	 point when a forward declaration is involved.  */

I'm not happy with this heuristic. Wouldn't the same bug occur if a typedef was used to give a name to the pointer type? In any case, I can't see any intuitive reason for making anonymity have semantics in the middle end. (It does have semantics in some languages, of course, so in the front end I would not have the same objection.)

I think that this is a more fundamental problem. Since we only have one node for a type, the first use of a pointer type may point to a variable-length array whose size isn't known at the point the pointer type is used.

On that basis, I thin Jakub's patch is suspect for PR 21536, and that we should not recur on pointer types. Perhaps the middle-end should just ignore the bounds for VLAs, and treat them as unknown, at least in some situations.

Mark Mitchell
(650) 331-3385 x713

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