constant expression bug in gcc

Peter Selinger selinger@mathstat.uottawa.ca
Mon Nov 19 15:56:00 GMT 2001


There is an apparent bug in constant expression evaluation in gcc 2.96.

Here is a program:

#include <stdio.h>

int main() {
  printf("%d\n", sizeof(unsigned long)-5 );
  printf("%d\n", (sizeof(unsigned long)-5) >= 0 ? 1 : -1);
}

Here is its output:

% ./test
-1
1
% uname -a
Linux caiaphas 2.2.19-7.0.8 #1 Thu Jun 21 04:59:33 EDT 2001 i686 unknown
% gcc --version
2.96

Please let me know if you need more information. 
Thanks, -- Peter



More information about the Gcc-bugs mailing list