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.

Reply via email to