From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23059 invoked by alias); 12 Feb 2002 14:46:10 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23001 invoked by uid 71); 12 Feb 2002 14:46:03 -0000 Resent-Date: 12 Feb 2002 14:46:03 -0000 Resent-Message-ID: <20020212144603.23000.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, reichelt@igpm.rwth-aachen.de Received:(qmail 20587 invoked by uid 61); 12 Feb 2002 14:41:25 -0000 Message-Id:<20020212144125.20583.qmail@sources.redhat.com> Date: Tue, 12 Feb 2002 06:46:00 -0000 From: reichelt@igpm.rwth-aachen.de Reply-To: reichelt@igpm.rwth-aachen.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/5666: ICE compiling old style C code with g++ X-SW-Source: 2002-02/txt/msg00274.txt.bz2 List-Id: >Number: 5666 >Category: c++ >Synopsis: ICE compiling old style C code with g++ >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-illegal-code >Submitter-Id: net >Arrival-Date: Tue Feb 12 06:46:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Volker Reichelt >Release: gcc version 3.1 20020204 (experimental) >Organization: >Environment: mips-sgi-irix6.5, i686-pc-linux-gnu >Description: The following code snippet is legal old-style C code. However, it is illegal C++ code. In fact it will cause an ICE, when compiled with g++: ------------------------snip here----------------------- void foo (i, j) int i; int j; { quus(j); quus(j); } void bar (k) int k; { int l; struct { int a[3]; } j; } ------------------------snip here----------------------- The error message reads: OldStyle.cpp:1: `i' was not declared in this scope OldStyle.cpp:1: `j' was not declared in this scope OldStyle.cpp:2: variable or field `foo' declared void OldStyle.cpp:2: initializer list being treated as compound expression OldStyle.cpp:2: syntax error before `int' OldStyle.cpp:4: parse error before `{' token OldStyle.cpp:6: ISO C++ forbids declaration of `quus' with no type OldStyle.cpp:7: parse error before `}' token OldStyle.cpp:9: `k' was not declared in this scope OldStyle.cpp:10: variable or field `bar' declared void OldStyle.cpp:10: syntax error before `int' OldStyle.cpp:13: conflicting types for ` j' OldStyle.cpp:3: previous declaration as `int j' OldStyle.cpp:14: parse error before `}' token OldStyle.cpp: In function `void __static_initialization_and_destruction_0(int, int)': OldStyle.cpp:6: Internal compiler error in emit_move_insn, at expr.c:2748 Please submit a full bug report, [etc.] Remark: Be sure that the file has an extension like .cpp .cc .ii and not .c or .i (otherwise you'll invoke the C front-end, even if you use g++). >How-To-Repeat: g++ -c OldStyle.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted: