[Bug c/34154] New: gcc 4.1.1 bug / case ranges / unsigned long long
remi dot chateauneu at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Nov 19 21:45:00 GMT 2007
The following program should print "19==19", not "19==20".
It is a big switch/case with 'case ranges', whose values are 'unsigned long
long'. It wokrs for most values except the last range.
More details here:
http://groups.google.com/group/gnu.gcc/browse_thread/thread/e48be6e521697259#eacdee661f68b550
#include <stdio.h>
#define BIG_NUM 1000000000000000000ULL
static int foo( unsigned long long aLL )
{
switch( aLL )
{
case BIG_NUM ... 9999999999999999999ULL : return 19 ;
default : return 20 ;
};
};
int main( int argC, const char ** argV )
{
unsigned long long aLL = BIG_NUM ;
printf("19 == %d\n", foo( aLL ) );
return 0 ;
};
"this code does produce the value 19
on i686-pc-linux-gnu with gcc 2.95.3, 3.3.6, and 3.4.6,
but the value 20 with gcc 4.0.4, 4.1.2, and 4.2.2. "
It is taken from a sourceforge project:
http://itoa.cvs.sourceforge.net/*checkout*/itoa/itoa/itoa.c?revision=1.1.1.1
--
Summary: gcc 4.1.1 bug / case ranges / unsigned long long
Product: gcc
Version: 4.2.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: remi dot chateauneu at gmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34154
More information about the Gcc-bugs
mailing list