> I think that I should have Cc'ed the OP. Resending...
> 
> On 2026-07-14 09:56:44 +0000, Alexy via Tinycc-devel wrote:
> > #include <stdio.h>
> > 
> > int main()
> > {
> >     char t[5][0];
> [...]
> 
> This is a constraint violation:
> 
> In ISO C99, 6.7.5.2 Array declarators:
> 
>  [...] If they delimit an expression (which specifies the size of an
>  array), the expression shall have an integer type. If the expression
>  is a constant expression, it shall have a value greater than zero.
>  [...]
> 
> So this is just a missing diagnostic, not a serious bug!
> 

One nuance: TCC intentionally accepts zero length arrays as a GNU
extension. The real gap is that TCC has no effective strict/pedantic
mode in which the required ISO diagnostic is emitted.

After accepting the extension, every inner array access is undefined.
t[5] additionally exceeds the outer array. A zero row size also
explains why different rows may map to the same address.

A warning or pedantic mode enhancement would be appropriate. Rejecting
[0] unconditionally would break GNU compatibility.

Mounir IDRASSI




_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to