Bug 7679 - The compiler crashes wen a right parentesis is missing
The compiler crashes wen a right parentesis is missing
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
3.1
: P3 normal
: ---
Assigned To: Mark Mitchell
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-08-21 17:16 UTC by bmello
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
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 bmello 2002-08-21 17:16:00 UTC
	When I try to compile the code bellow using the command g++ teste.cpp the compiler crashes if one parentesis is missing in the end of the definition of the function double occupancy(int m).

Release:
3.1

Environment:
System: Linux localhost.localdomain 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /tmp/gcc-3.1/configure

How-To-Repeat:
Compile the program below using g++. There is a missing parentesis in the end 
of the line 
    {return L/(L+Ka*activity(m,1,activity())+Ki*(1-activity(m,1,activity()));}
that make the compiler crash.

const int n_methyl=2;

const double tiny=1e-10;

class receptors
 {
  public:
  static double C,E[n_methyl][2],Ka,Ki,L,fm[n_methyl];
  double x[10];
  receptors(){};
  double activity() {return x[0];}
  double activity(int,int,double);
  double occupancy(int m)
    {return L/(L+Ka*activity(m,1,activity())+Ki*(1-activity(m,1,activity()));}
  double occupancy()
   {double s=0; for(int m=0;m!=n_methyl;m++)s+=occupancy(m)*fm[m]; return s;}
  double methylation()
   {double s=0;for(int m=0;m!=n_methyl;m++) s+=m*fm[m]; return s;}
  void tune_fm(double);
  double show();
  void find_solution(double);
 };
Comment 2 Nathan Sidwell 2002-09-13 15:11:57 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: 3.2 & cvs go into an infinite loop
Comment 3 pop 2002-09-29 17:03:40 UTC
From: =?iso-8859-1?Q?Pop_S=E9bastian?= <pop@gauvain.u-strasbg.fr>
To: nathan@gcc.gnu.org, bmello@us.ibm.com, gcc-bugs@gcc.gnu.org,
	gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7679: The compiler crashes wen a right parentesis is missing
Date: Sun, 29 Sep 2002 17:03:40 +0200

 On Fri, Sep 13, 2002 at 10:11:57PM -0000, nathan@gcc.gnu.org wrote:
 > Synopsis: The compiler crashes wen a right parentesis is missing
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: nathan
 > State-Changed-When: Fri Sep 13 15:11:57 2002
 > State-Changed-Why:
 >     3.2 & cvs go into an infinite loop
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7679
 
 
 Tested with 3 gcc versions:
 
 seb@myp233:~/test/cp$ gcc-2.95 -v
 Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
 gcc version 2.95.4 20011002 (Debian prerelease)
 
 seb@myp233:~/test/cp$ gcc-3.0 -v
 Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
 Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
 Thread model: posix
 gcc version 3.0.4
 
 seb@myp233:~/test/cp$ gcc-3.2 -v
 Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.1/specs
 Configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2.1ds2/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-java-gc=boehm --enable-objc-gc i386-linux
 Thread model: posix
 gcc version 3.2.1 20020924 (Debian prerelease)
 
 
 Results for the original bug example:
 
 seb@myp233:~/test/cp$ gcc-2.95 -c pr7679.cc
 pr7679.cc: In method `double receptors::occupancy(int)':
 pr7679.cc:14: parse error before `;'
 Stops shortly.
 
 seb@myp233:~/test/cp$ gcc-3.0 -c pr7679.cc
 pr7679.cc: In member function `double receptors::occupancy(int)':
 pr7679.cc:14: parse error before `;' token
 Loops indefinitely.
 
 seb@myp233:~/test/cp$ gcc-3.2 -c pr7679.cc
 pr7679.cc: In member function `double receptors::occupancy(int)':
 pr7679.cc:14: parse error before `;' token
 Loops indefinitely.
 
 
 
 Also tested:
 
 struct f
 {
   int oo()
   {
     return (2;
   }
 };
 
 Slightly simpler to analyse than the original bug example,
 and produces the same infinite loop.
 
 
 Note that gcc-3.2 stops correctly when it gets only the function declaration:
 
   int oo()
   {
     return (2;
   }
 
 
Comment 4 Mark Mitchell 2002-10-23 00:48:33 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 5 Mark Mitchell 2002-10-23 14:57:53 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.2.1.
Comment 6 Mark Mitchell 2002-10-23 18:38:23 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7679
Date: 23 Oct 2002 18:38:23 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-23 11:38:23
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: inline1.C 
 
 Log message:
 	PR c++/7679
 	* spew.c (next_token): Do not return an endless stream of
 	END_OF_SAVED_INPUT tokens.
 	(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
 	the cached token stream.
 	(snarf_defarg): Likewise.
 	
 	PR c++/7679
 	* g++.dg/parse/inline1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3022&r2=1.3023
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&r1=1.74&r2=1.75
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2175&r2=1.2176
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/inline1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 7 Mark Mitchell 2002-10-23 18:38:23 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7679
Date: 23 Oct 2002 18:38:23 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-23 11:38:23
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: inline1.C 
 
 Log message:
 	PR c++/7679
 	* spew.c (next_token): Do not return an endless stream of
 	END_OF_SAVED_INPUT tokens.
 	(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
 	the cached token stream.
 	(snarf_defarg): Likewise.
 	
 	PR c++/7679
 	* g++.dg/parse/inline1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3022&r2=1.3023
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&r1=1.74&r2=1.75
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2175&r2=1.2176
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/inline1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 
Comment 8 Mark Mitchell 2002-10-23 21:56:56 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7679
Date: 23 Oct 2002 21:56:56 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-23 14:56:56
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: inline1.C 
 
 Log message:
 	PR c++/7679
 	* spew.c (next_token): Do not return an endless stream of
 	END_OF_SAVED_INPUT tokens.
 	(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
 	the cached token stream.
 	(snarf_defarg): Likewise.
 	
 	PR c++/7679
 	* g++.dg/parse/inline1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.30&r2=1.2685.2.114.2.31
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.61.6.2&r2=1.61.6.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.36&r2=1.1672.2.166.2.37
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/inline1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 

Comment 9 Mark Mitchell 2002-10-23 21:56:56 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7679
Date: 23 Oct 2002 21:56:56 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-23 14:56:56
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: inline1.C 
 
 Log message:
 	PR c++/7679
 	* spew.c (next_token): Do not return an endless stream of
 	END_OF_SAVED_INPUT tokens.
 	(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
 	the cached token stream.
 	(snarf_defarg): Likewise.
 	
 	PR c++/7679
 	* g++.dg/parse/inline1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.30&r2=1.2685.2.114.2.31
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.61.6.2&r2=1.61.6.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.36&r2=1.1672.2.166.2.37
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/inline1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1