Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Richard Kessler {66651 CF/DEV}
Mon, 11 Jan 1993 22:28
gcc bug report
Author: 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;
}
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads