Article View: gnu.gcc.bug
Article #2854GCC 1.36 does not report enumeration constants that are too large
From: Paul Eggert
Date: Tue, 06 Feb 1990 22:35
Date: Tue, 06 Feb 1990 22:35
15 lines
1131 bytes
1131 bytes
GCC 1.36 (SPARCstation 1, SunOS 4.0.3c) compiles and runs the following program
without complaint; main() surprisingly yields 0.
enum {NEG = -1, POS = 4294967295} neg = NEG, pos = POS;
main() { return (neg < pos) == (NEG < POS); }
GCC should report an error, because the constant 4294967295 violates ANSI C
3.5.2.2's constraint ``The expression that defines the value of an enumeration
constant shall be an integral constant expression that has a value
representable as an int.''
It might also be nice (although not required) for GCC to report the overflow in
the enumeration specifier
enum {X = 2147483647, X_PLUS_1}
Technical Details
Message-ID:
<9002062235.AA12481@ata.twinsun.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bu.edu!bu-cs!snorkelwacker!think!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!twinsun.com!eggertShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bu.edu!bu-cs!snorkelwacker!think!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!twinsun.com!eggert From: eggert@twinsun.com (Paul Eggert) Newsgroups: gnu.gcc.bug Subject: GCC 1.36 does not report enumeration constants that are too large Message-ID: <9002062235.AA12481@ata.twinsun.com> Date: 6 Feb 90 22:35:21 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 15