Article View: gnu.g++.bug
Article #1585g++ fails to parse correct C variable definition
From: "Douglas C. Schmidt"
Date: Sun, 01 Jan 1989 20:57
Date: Sun, 01 Jan 1989 20:57
39 lines
1683 bytes
1683 bytes
Hi,
The following short C++ program fails to compile with g++ 1.32.
It does compile with gcc 1.32, and also compiles if
int (*ap)[20];
is moved to the outer scope or declared with storage class static.
Interestingly, AT&T cfront 1.2.1 also botches this.
Here's the code:
----------------------------------------
main ( ) {
int a [ 10 ] [ 20 ];
int (*ap)[ 20 ];
}
----------------------------------------
And here are the diagnostics:
----------------------------------------
g++ version 1.32.0
/usr/public/lib/g++/gcc-cpp -+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix test.c /tmp/cca06496.cpp
GNU CPP version 1.32
/usr/public/lib/g++/gcc-c++ /tmp/cca06496.cpp -quiet -dumpbase test.c
-fstrength-reduce -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -version -o /tmp/cca06496.s
GNU C++ version 1.32.0 (sparc) compiled by GNU C version 1.31.
In function int main ():
test.c:5: `ap' was not declared (first use this function)
test.c:5: (Each undeclared identifier is reported only once
test.c:5: for each function it appears in.)
test.c:6: warning: variable `a' never used
----------------------------------------
Doug
Technical Details
Message-ID:
<8901011305.aa03599@PARIS.ICS.UCI.EDU>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%siam.ics.uci.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%siam.ics.uci.edu
From: schmidt%siam.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: g++ fails to parse correct C variable definition
Message-ID: <8901011305.aa03599@PARIS.ICS.UCI.EDU>
Date: 1 Jan 89 20:57:32 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 39