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

           Summary: Bogus overflow in constant expression warning
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org


typedef __SIZE_TYPE__ size_t;

extern char a[((size_t)-1 >> 1) + 1]; /* { dg-error "too large" } */
extern char b[((size_t)-1 >> 1)];
extern int c[(((size_t)-1 >> 1) + 1) / sizeof(int)]; /* { dg-error "too large"
} */
extern int d[((size_t)-1 >> 1) / sizeof(int)];

is rejected with -pendantic-errors:

t.c:3:13: error: size of array 'a' is too large
t.c:4:1: error: overflow in constant expression [-Woverflow]
t.c:5:12: error: size of array 'c' is too large
t.c:6:1: error: overflow in constant expression [-Woverflow]

the overflows reported are bogus.

Reply via email to