Bug 85144

Summary: gcc internal error (seg fault)
Product: [Retired] Red Hat Linux Reporter: andy <rafoulks>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-03 12:32:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description andy 2003-02-26 00:17:00 UTC
Description of problem:

segmentation fault on this program "test.c":

#include <stdio.h>

int foo = 3;

int main(void)
{
    auto int bar(int);

    extern int foo;

    {
        int foo = 5;
        printf("foo is %d\n",foo);
    }

    bar(5);

    printf("foo is %d\n",foo);
}

void bar(void)
{
    printf("i am bar\n");
}


Version-Release number of selected component (if applicable):

% gcc --version
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


How reproducible:

easy as pie.

Steps to Reproduce:
1. gcc test.c
2.
3.
    
Actual results:

% gcc test.c
test.c: In function `bar':
test.c:19: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


Expected results:

I think that line 7 should produce an error saying that local functions cannot
have "auto" storage class.

Additional info:

Comment 1 Richard Henderson 2004-10-03 12:32:08 UTC
GCC supports an extension called nested functions, by which functions
*can* have "auto" storage class.

With gcc 3.2.3-20, we no longer ICE, generate no warning, which results
in the rather obscure link error

: undefined reference to `bar.0'

Pushed upstream to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17807