[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tccgen.c: off by one in flexible array members

From: Michael Matz
Subject: Re: [Tinycc-devel] tccgen.c: off by one in flexible array members
Date: Fri, 11 Mar 2016 23:39:27 +0100 (CET)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Fri, 11 Mar 2016, Michael Matz wrote:

This whole thing also points out some deficiencies of tcc to emit error messages. For instance it accepts the initialization

void f(void) {
 struct w q = {"bugs", { 'c' } };

(and sets ref->c to 1), even though this is a non-static initialization, which is wrong (but the size adjustments needs also to be done for static initialization).

And even that is only a GCC extension. One isn't allowed to initialize flex array members, only via malloc and assignments. (But the GCC extension is probably quite prevalent as GCC doesn't even warn about it in conformant mode.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]