This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/48850] New: Bogus overflow in constant expression warning


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]