Article View: gnu.gcc.bug
Article #1629gcc bug report
From: Richard Kessler {66651 CF/DEV}
Date: Mon, 11 Jan 1993 22:28
Date: Mon, 11 Jan 1993 22:28
70 lines
1509 bytes
1509 bytes
/*
GCC BUG: bad code with nested switches and double-length
integers.
This is example code to exercise a gcc bug.
On a "sparc-sun-sunos4.1" with gcc version 2.2.2, the
following code core dumps. I used "gcc -ggdb file.c" to
compile.
I can fix it by: (a) the "#define switch(a) switch((int)(a))"
below, or (b) "typedef int longint" instead of
"typedef long long longint". The nested switch also seems
important; I don't think it will core dump with just one
switch level.
It coredumps on the outermost "switch".
*/
#include <stdio.h>
/*
#define switch(a) switch((int)(a))
*/
typedef long long longint;
void main(void);
void wwrite(longint);
void main(void)
{
wwrite((longint) 0);
}
void wwrite(longint i)
{
longint j = 0;
switch(i)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 0xa:
case 0x1c:
j = 1;
case 23:
switch(j)
{
case 0:
printf("hello\n");
break;
case 1:
printf("bye\n");
break;
}
break;
case 47:
printf("hi\n");
break;
default:
printf("ho\n");
break;
}
}
Technical Details
Message-ID:
<9301112228.AA05135@trek.cray.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!romulus.CRay.COM!kesslerShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!romulus.CRay.COM!kessler
From: kessler@romulus.CRay.COM (Richard Kessler {66651 CF/DEV})
Subject: gcc bug report
Message-ID: <9301112228.AA05135@trek.cray.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 11 Jan 1993 22:28:29 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 71