[PATCH, PR 57748] Check for out of bounds access, Part 2

Bernd Edlinger bernd.edlinger@hotmail.de
Sun Oct 13 12:30:00 GMT 2013


Hi Eric,

>> Would you agree that this "error: flexible array member"
>> should also be emitted for a zero-sized array member,
>> maybe as "error: zero-sized array member not at end of struct"?
>
> I would have answered yes when zero-sized arrays where introduced, but it's
> far less clear a couple of decades later IMO.

But if zero-sized arrays everywhere in a structure is valid C,
then the attached test case is a valid test case.
And it will break your patch for PR58570 at -O1 and above,
because you can no longer assume that different array members
are not an alias.


Regards
Bernd. 		 	   		  
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr58570-1.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131013/a6643545/attachment.c>


More information about the Gcc-patches mailing list