Bug 19739 - [3.4 Regression] ICE with additional comma in attribute
Summary: [3.4 Regression] ICE with additional comma in attribute
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 minor
Target Milestone: 3.4.4
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2005-02-01 09:00 UTC by Michael Cieslinski
Modified: 2005-02-10 01:13 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-02-01 13:25:34


Attachments
obvious fix (965 bytes, patch)
2005-02-09 09:33 UTC, Steven Bosscher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2005-02-01 09:00:03 UTC
In a function attribute I had comma more than needed and I got an ICE. Below is 
a small program to demonstrate this:

Michael Cieslinski


void Dummy() __attribute__(( , ));
void Dummy() {}

int main (int argc, char **argv)
{
    Dummy();
    return 0;
}


when compiled it results in an ICE:

g++  -c -o bug.o bug.cpp 
../../../Portabel/MetisIP/link/bug.cpp:2: error: expected `)' before ',' token
../../../Portabel/MetisIP/link/bug.cpp:2: error: expected `)' before ',' token
../../../Portabel/MetisIP/link/bug.cpp:2: internal compiler error: tree check: 
expected tree_list, have error_mark in lookup_attribute, at tree.c:3080
Please submit a full bug report, with preprocessed source if appropriate.


g++ -v
Using built-in specs.
Configured with: ../gcc40/configure --prefix=/usr/local/gcc40c --program-
suffix=40c --with-arch=opteron --enable-languages=c,c++ --enable-checking
Thread model: posix
gcc version 4.0.0 20050130 (experimental)
Comment 1 Andrew Pinski 2005-02-01 12:52:06 UTC
Hmm, we used to accept this before 3.4.0 and we still do in the C front-end.
Comment 2 Andrew Pinski 2005-02-01 13:25:33 UTC
This a regression no matter if this is valid or invalid code, an ICE from compiling/not compiling is a 
regression.
Comment 3 jsm-csl@polyomino.org.uk 2005-02-01 13:49:00 UTC
Subject: Re:  ICE with additional comma in attribute

On Tue, 1 Feb 2005, pinskia at gcc dot gnu dot org wrote:

> Hmm, we used to accept this before 3.4.0 and we still do in the C front-end.

This is valid code (according to the documentation I wrote, "Attribute 
Syntax" in the manual): attributes may be empty.

Comment 4 Andrew Pinski 2005-02-01 17:46:43 UTC
: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk (#160).
This is caused by the new parser as JSM said this is valid.
Comment 5 Steven Bosscher 2005-02-09 09:33:42 UTC
Created attachment 8151 [details]
obvious fix

Sorry Mark, I didn't notice this was assigned to you already.  Maybe this takes
some work out of your hands ;-)
Comment 6 Steven Bosscher 2005-02-09 10:23:08 UTC
Comment on attachment 8151 [details]
obvious fix

Except that it is an ICE on _valid_, not invalid.  Bogus patch.
Comment 7 GCC Commits 2005-02-10 00:35:11 UTC
Subject: Bug 19739

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-02-10 00:34:47

Modified files:
	gcc/cp         : ChangeLog call.c decl.c parser.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/template: crash2.C 
Added files:
	gcc/testsuite/g++.dg/conversion: ambig1.C 
	gcc/testsuite/g++.dg/ext: attrib19.C 
	gcc/testsuite/g++.dg/parse: dtor5.C 
	gcc/testsuite/g++.dg/template: dtor3.C static11.C 

Log message:
	PR c++/19787
	* call.c (initialize_reference): Robustify.
	
	PR ++/19732
	* decl.c (grokdeclarator): Check for invalid use of destructor
	names.
	
	PR c++/19762
	* parser.c (cp_parser_unqualified_id): Avoid creating destructor
	names with invalid types.
	
	PR c++/19826
	* parser.c (cp_parser_direct_declarator): Allow type-dependent
	expressions as array bounds.
	
	PR c++/19739
	* parser.c (cp_parser_attributes_list): Allow empty lists.
	
	PR c++/19787
	* g++.dg/conversion/ambig1.C: New test.
	
	PR c++/19739
	* g++.dg/ext/attrib19.C: New test.
	
	PR c++/19732
	* g++.dg/parse/dtor5.C: New test.
	
	PR c++/19762
	* g++.dg/template/dtor3.C: New test.
	
	PR c++/19826
	* g++.dg/template/static11.C: New test.
	* g++.dg/template/crash2.C: Remove dg-error marker.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4618&r2=1.4619
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.528&r2=1.529
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1360&r2=1.1361
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.313&r2=1.314
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5011&r2=1.5012
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/conversion/ambig1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib19.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/dtor5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/dtor3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash2.C.diff?cvsroot=gcc&r1=1.3&r2=1.4

Comment 8 Mark Mitchell 2005-02-10 00:42:23 UTC
Fixed in 4.0.
Comment 9 GCC Commits 2005-02-10 01:12:41 UTC
Subject: Bug 19739

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2005-02-10 01:10:16

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog call.c parser.c 
Added files:
	gcc/testsuite/g++.dg/conversion: ambig1.C 
	gcc/testsuite/g++.dg/ext: attrib19.C 
	gcc/testsuite/g++.dg/template: dtor3.C 

Log message:
	PR c++/19787
	* call.c (initialize_reference): Robustify.
	
	PR c++/19762
	* parser.c (cp_parser_unqualified_id): Avoid creating destructor
	names with invalid types.
	
	PR c++/19739
	* parser.c (cp_parser_attributes_list): Allow empty lists.
	
	PR c++/19787
	* g++.dg/conversion/ambig1.C: New test.
	
	PR c++/19739
	* g++.dg/ext/attrib19.C: New test.
	
	PR c++/19762
	* g++.dg/template/dtor3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.357&r2=1.3389.2.358
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/conversion/ambig1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib19.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/dtor3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.195&r2=1.3892.2.196
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.22&r2=1.452.2.23
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.51&r2=1.157.2.52

Comment 10 Mark Mitchell 2005-02-10 01:13:05 UTC
Fixed in GCC 3.4.4.