This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/717: Extra brackets can lead to internal compiler error during parsing.



>Number:         717
>Category:       c++
>Synopsis:       Extra brackets can lead to internal compiler error during parsing.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 31 05:16:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     dommo@imsltd.com
>Release:        2.97 20001024 (experimental)
>Organization:
>Environment:
RedHat Linux release 6.2, kernel version 2.2.14-5.0 with binutils-2.9.5.0.22-6.
>Description:
Certain complex expresssions sometimes cause an internal compiler error if they are enclosed in too many brackets. The case we found (see the 'how-to-repeat' section) was in code generated by another compiler, and occurs because brackets are generated both for the if statement and the expression contained within it.

I don't believe that this problem existed with the last official release of the compiler (2.95.2).
>How-To-Repeat:
The following code demonstrtes the bug. It is a cutdown extract from actual code, generated by another compiler. I did try to simplify it further, but with no success - sorry!

class _eAny
{
  public:
    _eAny(){}
};

template <class X>
class _eSeq
{
  public:
    _eSeq(const X thing){}
    int _oHash() {return 0;}
    _eSeq<X > _oPlusPlus(const _eSeq<X > other) const
    {
      return *this;
    }
    _eSeq<X > take(const _eSeq<X > other) const
    {
      return *this;
    }
};

template <class X>
class _eHndl
{
  public:
    _eHndl(const _eAny *obj){}
};

class VarInstances : public _eAny
{
  public:
    VarInstances() : _eAny() {}
};

void testFunc(const VarInstances *testInstance)
{
  const _eSeq<_eHndl<VarInstances> > temp1 = _eSeq<_eHndl<VarInstances> >(_eHndl<VarInstances>(testInstance));

  // it's the extra brackets around the whole expression here that cause the I.C.E. ...
  if((_eSeq<_eHndl<VarInstances> >(_eHndl<VarInstances>(testInstance))._oPlusPlus(temp1)._oHash() == 7))
  {
    return; 
  }
}

int main(int argc, char** argv)
{
  testFunc(new VarInstances());
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]