public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/98609] New: sanitizer diagnoses VLAs with length zero although zero-length arrays are a GNU extension
@ 2021-01-08 21:46 muecker at gwdg dot de
  2021-01-11  8:15 ` [Bug sanitizer/98609] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2021-01-08 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98609

            Bug ID: 98609
           Summary: sanitizer diagnoses VLAs with length zero although
                    zero-length arrays are a GNU extension
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

The following code is diagnosed with -fsanitize=undefined:

int main()
{
        int n = 0;
        double x[n];
}


runtime error: variable length array bound evaluates to non-positive value 0


But arrays of zero length are often useful and also generally support by GCC as
an extension. So it would be useful if this would get diagnosed by default. At
least there should be a way to turn this off.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-30 10:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 21:46 [Bug sanitizer/98609] New: sanitizer diagnoses VLAs with length zero although zero-length arrays are a GNU extension muecker at gwdg dot de
2021-01-11  8:15 ` [Bug sanitizer/98609] " marxin at gcc dot gnu.org
2021-01-11  9:04 ` jakub at gcc dot gnu.org
2021-01-11  9:11 ` muecker at gwdg dot de
2021-01-11  9:19 ` jakub at gcc dot gnu.org
2021-01-11  9:24 ` marxin at gcc dot gnu.org
2021-01-11  9:30 ` jakub at gcc dot gnu.org
2021-01-11  9:42 ` marxin at gcc dot gnu.org
2021-01-11 17:58 ` msebor at gcc dot gnu.org
2023-07-30 10:15 ` muecker at gwdg dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).