This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48850] New: Bogus overflow in constant expression warning
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 3 May 2011 08:59:32 +0000
- Subject: [Bug c/48850] New: Bogus overflow in constant expression warning
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: rguenth@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.