This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/1575: 12-line C program coredumps gcc version 2.96
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/1575: 12-line C program coredumps gcc version 2.96
- From: esr at thyrsus dot com
- Date: 6 Jan 2001 23:14:44 -0000
- Reply-To: esr at thyrsus dot com
>Number: 1575
>Category: c
>Synopsis: 12-line C program coredumps gcc version 2.96
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jan 06 15:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Eric S. Raymond
>Release: gcc 2.96
>Organization:
>Environment:
Red Hat 7.0
>Description:
/*
* Compile this under
* gcc version 2.96 20000731 (Red Hat Linux 7.0)
* to core-dump the compiler.
*
* This is a minimal example; I couldn't delete any more statements
* and still produce the segfault.
*
* Bug submitted by Eric S. Raymond, 6 Jan 2001.
*/
void croak(void)
{
int swap, swapval, i, *scramble;
if ((scramble = (foo *) malloc(bar, sizeof(int)) == NULL)
{
fprintf(stderr, "this would never compile anyway\n");
}
swapval = scramble[swap];
scramble[swap] = scramble[i];
}
>How-To-Repeat:
/*
* Compile this under
* gcc version 2.96 20000731 (Red Hat Linux 7.0)
* to core-dump the compiler.
*
* This is a minimal example; I couldn't delete any more statements
* and still produce the segfault.
*
* Bug submitted by Eric S. Raymond, 6 Jan 2001.
*/
void croak(void)
{
int swap, swapval, i, *scramble;
if ((scramble = (foo *) malloc(bar, sizeof(int)) == NULL)
{
fprintf(stderr, "this would never compile anyway\n");
}
swapval = scramble[swap];
scramble[swap] = scramble[i];
}
>Fix:
No fix.
>Release-Note:
>Audit-Trail:
>Unformatted: