bug-patch
[Top][All Lists]
Advanced

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

Re: [bug-patch] "safe.c", line 264: error: zero or negative subscript


From: Andreas Grünbacher
Subject: Re: [bug-patch] "safe.c", line 264: error: zero or negative subscript
Date: Sat, 3 Oct 2015 15:26:38 +0200

Dennis,

2015-10-03 2:46 GMT+02:00 address@hidden <address@hidden>:
> There appears to be a trivial bug in src/safe.c wherein a zero size
> array was defined and this is not in compliance with  ISO C99 update
> WG14/N1256.  In section 6.7.8 Initialization of the standard there does
> not appear to be allowance for a zero size array such as buffer[0]
> however we do see this in the GNU world thus :
>
> section : 6.17 Arrays of Length Zero
> https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
>
> Therefore GCC compiler would most likely just silently accept this
> unless I enforced compliance mode.

Indeed.

> A somewhat hackary fix is just to make buffer[] a size 1 array like so :
> [...] However that buffer[1] probably does not need to exist at all.

It isn't hard to get rid of that; let me push a fix.

Andreas



reply via email to

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