Bug 9749 - [3.2 regression] ICE in write_expression on invalid function prototype
Summary: [3.2 regression] ICE in write_expression on invalid function prototype
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-02-18 21:56 UTC by liberti
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description liberti 2003-02-18 21:56:00 UTC
/* the following code causes gcc and g++ 3.2 to crash 
with an internal error. The code shouldn't compile
anyway, but neither should the compiler crash.
gcc 2.95.2 correctly reports the mistakes in the 
snippet */

int main(int argc, char** argv) {
        int nx = 2;
        void theerror(double a[][nx+1]);
        double** a = new double * [1];
        a[0] = new double [3];
        a[0][0] = 0;
        theerror(a);
        return 0;
}

void theerror(double a[][nx+1]) {
        a[0][0] = 1;
}

Release:
3.2

Environment:
GNU/Linux 2.4.18 on a RedHat 8.0 distribution
Comment 1 liberti 2003-02-18 21:56:00 UTC
Fix:
Fixed in GCC 3.3, GCC 3.4 with:

http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01891.html
Comment 2 Wolfgang Bangerth 2003-02-18 22:14:52 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. A regression in the C++ front end introduced
    between 2.95 and 3.0 that is still there in mainline of
    yesterday, as well as (of course) in 3.2.2 and 3.3.
    
    Reduced code is
    ----------------------
    void foo(double a[][2]);
    
    void bar() {
      int nx = 2;
      void foo(double a[][nx]);
      foo(0);
    }
    -----------------------------
    
    tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc
    x.cc: In function `void bar()':
    x.cc:6: internal compiler error: Segmentation fault
    Please submit a full bug report,
    
    
    It ICEs here:
    #0  0x4009db33 in strlen () from /lib/libc.so.6
    #1  0x08146004 in write_expression (expr=0x0)
        at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1985
    #2  0x08147016 in write_array_type (type=0x401c2804)
        at ../../gcc-3.4-CVS/gcc/cp/mangle.c:2185
    #3  0x0814501d in write_type (type=0x401c2804)
        at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1405
    #4  0x08144f28 in write_type (type=0x401c2804)
        at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1400
    
    W.
Comment 3 Wolfgang Bangerth 2003-02-20 11:18:56 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9749
Date: Thu, 20 Feb 2003 11:18:56 -0600 (CST)

 This one looks like it is related to PR 9778, although the code is very 
 different and the time when it was introduced is also vastly different.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 
 
Comment 4 Joe Buck 2003-04-25 20:57:57 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.