[Bug c/68845] New: -Werror=array-bounds=[12] doesn't turn warning into error

sirl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 10 19:02:00 GMT 2015


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

            Bug ID: 68845
           Summary: -Werror=array-bounds=[12] doesn't turn warning into
                    error
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

With trunk gcc r231490, for a simple out of bounds access like

int arr[3];

int f(void)
{
    return arr[5];
}

-Werror=array-bounds=[12] don't turn the warning into an error:

# gcc-6 -c -O2 -Werror=array-bounds=2 test.c
test.c: In function 'f':
test.c:6:15: warning: array subscript is above array bounds [-Warray-bounds]
     return arr[5];
            ~~~^~~


gcc-5.3.0 behaves the same way, so this is likely no regression.


More information about the Gcc-bugs mailing list