public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/4077: -fshort-enums makes enumerations behave unsigned
@ 2001-08-22 3:26 Cristan Szmajda
0 siblings, 0 replies; only message in thread
From: Cristan Szmajda @ 2001-08-22 3:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 4077
>Category: optimization
>Synopsis: -fshort-enums makes enumerations behave like unsigned int not int
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Aug 22 03:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.0.1 20010721 (Debian prerelease) (Debian testing/unstable)
>Organization:
University of New South Wales
>Environment:
System: Linux om 2.2.16 #1 Fri Aug 25 11:02:24 EST 2000 i686 unknown
Architecture: i686
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
-fshort-enums breaks OpenSSH. Specifically, initialize_options()
sets an enumeration like this: options->log_level = (LogLevel) - 1;
Later, the test options.log_level == -1 in main() returns false when
it should be true.
Now while the OpenSSH code is shameful, it is legal. The C Reference
Manual chapter A4 verse 2 clearly states:
Enumerations behave like integers, but it is common for a
compiler to issue a warning when an object of a particular
enumeration type is assigned is assigned something other than
one of its constants, or an expression of its type.
-Wall did report:
comparison is always false due to limited range of data type
but the enumeration is still behaving like an unsigned int, not an int.
>How-To-Repeat:
Compile OpenSSH with CFLAGS=-fshort-enums .
>Fix:
Sorry, no fix known.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-08-22 3:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 3:26 optimization/4077: -fshort-enums makes enumerations behave unsigned Cristan Szmajda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).