Missing () generates ICE

Bob Glamm glamm@ece.umn.edu
Fri Jul 17 12:46:00 GMT 1998


FYI - this is a bug report only (no patch).  But a specific bug report, 
at least, including the source to reproduce the ICE.  Let me know if you
need more info.  I wish I could submit a patch for this but lexical 
scanning and parse tree/symbol tree manipulation just aren't my hill
of beans ;)

Oh, one more thing: I've verified that the compiler DOES work on other
code that I've compiled (using STL, iostream, all the goodies).  This
bug might be reproducible by using a simpler 'class test' than 
what is shown in the Full Source Code below -- something like this might
be trigger it:
  class test
  {
  public:
    virtual bool recurse()
    {
      if(!recurse)
	return(false);
    }
  }

-- BUG REPORT --

egcs version: release 1.03, built from source tree using gcc-2.8.1.

Platform:     mips-sgi-irix5.3, using binutils 2.8.1 (this is a bug in the
	      compiler driver itself though, not the binutils).

Description of error: 
  I forgot the () on a recursive call to a member function; the line
  with the missing () generated the ICE.

Error message:
% egcs/bin/g++ -o test test.cpp
test.cpp: In method `bool test::isToast()':
test.cpp:17: Internal compiler error.
test.cpp:17: Please submit a full bug report to `egcs-bugs@cygnus.com'.

Full source code to reproduce bug:
#include <vector>
#include <iostream>

class test
{
public:
  test *innerTest;
  vector<test *> otherTests;
  virtual bool isToast(void)		// recursive function
  {
    if(!innerTest->isToast())		// first call - this is ok
      return(false);
    
    for(vector<test *>::iterator i = otherTests.begin();
	i != otherTests.end(); i++)
    {
      if(!((*i)->isToast)) // <-- ERROR LINE - I forgot the () here
	return(false);
    }

    return(true);
  }
};

int main(int argc, char *argv[])
{
  test *t = new test;

  if(t->isToast())
    cout << "toast\n";
}

-- 
Stan:"Dolphins ARE intelligent | Bob Glamm  H: +1 612 5090533 W: +1 612 6268981
      creatures!"              | URL:       http://www-mount.ee.umn.edu/~glamm
Cartman:"Yeah, intelligent on  +-----------------------------------------------
         rye bread with mayo!" -- Comedy Central's _South Park_, Wed. 10ET



More information about the Gcc-bugs mailing list