$ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)
$ uname -a Linux localhost.localdomain 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 15:37:31 EDT 2007 i686 i686 i386 GNU/Linux the following code: #include <stdio.h> enum X { A = 3, B = 1, C, D, E }; int main() { printf("%d;\n", B == A); printf("%d;\n", C == A); printf("%d;\n", D == A); printf("%d;\n", E == A); return 0; } compiled with: $ gcc -Wall -Wextra -ansi -pedantic -save-temps -o foo foo.c gives as output: $ ./foo 0; 0; 1; 0; -- Summary: erroneous enum comparison results Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: entrophage at gmail dot com GCC host triplet: i686-pc-linux-gnu GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32531