[Bug c/33024] gcc allows negatively-sized arrays

sdyoung at miranda dot org gcc-bugzilla@gcc.gnu.org
Wed Aug 8 17:35:00 GMT 2007



------- Comment #8 from sdyoung at miranda dot org  2007-08-08 17:34 -------
Consider:

main() {
  int x[0xFFFFFFFD];
}

fails to compile (array too large).

main() {
  int y = 0xFFFFFFFD;
  int x[y];
}

does compile.  Somewhere, your error checking (or lack thereof) for VLAs is
broken.  Unless I have just successfully allocated an array that is two bytes
shy of my entire virtual memory address space on a 32-bit architecture.


-- 

sdyoung at miranda dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33024



More information about the Gcc-bugs mailing list