This is the mail archive of the gcc@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]

Bug (Solaris-Sparc) added in 971122


This is the same bug I just reported in:

     http://www.cygnus.com/ml/egcs-bugs/1997-Dec/0265.html

but some of my information there was not completely accurate.  It
looks like the bug I was referring to was added in the egcs-971122
snapshot.  The egcs-971114 snapshot seems to work.  The source file is
pasted at the end:

=============================================================================
egcs-2.90.17   (971114)
=============================================================================
g++ -V egcs-2.90.17 -v -c tmp2.cc -o tmp2.o
Reading specs from /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.17/specs
gcc version egcs-2.90.17 971114 (gcc2-970802 experimental)
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.17/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) tmp2.cc /var/tmp/cca005zO.ii
GNU CPP version egcs-2.90.17 971114 (gcc2-970802 experimental) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /d4mutl/contrib/egcs/include/g++
 /usr/local/include
 /d4mutl/contrib/egcs/sparc-sun-solaris2.5.1/include
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.17/include
 /usr/include
End of search list.
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.17/cc1plus /var/tmp/cca005zO.ii -quiet -dumpbase tmp2.cc -version -o /var/tmp/cca005zO.s
GNU C++ version egcs-2.90.17 971114 (gcc2-970802 experimental) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.91.02 971206 (gcc-2.8.0).
 /d4mutl/contrib/egcs/sparc-sun-solaris2.5.1/bin/as -V -Qy -s -o tmp2.o /var/tmp/cca005zO.s
GNU assembler version 971105 (sparc-sun-solaris2.5.1), using BFD version 971105

=============================================================================
egcs-2.90.18    (971122)
=============================================================================
g++ -V egcs-2.90.18 -v -c tmp2.cc -o tmp2.o
Reading specs from /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.18/specs
gcc driver version egcs-2.90.17 971114 (gcc2-970802 experimental) executing gcc version egcs-2.90.18
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.18/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) tmp2.cc /var/tmp/cca005zu.ii
GNU CPP version egcs-2.90.18 971122 (gcc2-970802 experimental) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /d4mutl/contrib/egcs/include/g++
 /usr/local/include
 /d4mutl/contrib/egcs/sparc-sun-solaris2.5.1/include
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.18/include
 /usr/include
End of search list.
 /d4mutl/contrib/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.18/cc1plus /var/tmp/cca005zu.ii -quiet -dumpbase tmp2.cc -version -o /var/tmp/cca005zu.s
GNU C++ version egcs-2.90.18 971122 (gcc2-970802 experimental) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.90.18 971122 (gcc2-970802 experimental).
tmp2.cc: In function `int main()':
tmp2.cc:160: Internal compiler error.
tmp2.cc:160: Please submit a full bug report to `egcs-bugs@cygnus.com'.
=============================================================================

tmp2.cc:

#include <list>

template < class N, class A >
class Base
{
public:
    class NN : public N
    {
        friend Base<N,A>;
        friend ostream& operator<<(ostream &os, const NN& n)
        {
            n.print(os);
            return os;
        }
    public:
        void print(ostream &os) const
        {
            os << "Base<N,A>::print()" << endl;
            N::print(os);
        }
    };

    typedef NN*                        NNPtr;
    typedef list<NNPtr>                NList;
    typedef NList::iterator            n_list_iter;

    class n_iter : public n_list_iter 
    {
        friend bool operator<(n_iter a, n_iter b)
        {
            return (a->ind() < b->ind());
        }
        friend bool operator>(n_iter a, n_iter b)
        {
            return (a->ind() > b->ind());
        }

    public:
        n_iter() {}
        n_iter(n_list_iter i) : n_list_iter(i) {}
        
        NN& operator*()
            { return *n_list_iter::operator*();};
        NN* operator->() 
            { return n_list_iter::operator*(); }
    };
private:
    NList    ns;
    n_iter new_n_aux(NN* nd)
    {
        ns.push_back(nd);
        n_iter  nodi = --ns.end();
        return (nodi);
    }
public:
    n_iter new_n()
    {
        return new_n_aux(new NN());
    }
    void del_n(n_iter itr) 
    {
        NN* n = itr.operator->();
        ns.erase(itr);
        delete n;
    }
    n_iter           beg_n()          {   return (ns.begin()); }
    n_iter           end_n()          {   return (ns.end());   }
};

template <class XN, class XA>
class YN : public XN
{
public:    
    YN() {};
    void print(ostream& os) const
    {
        os << "YN<XN,XA>::print() " << endl;
        XN::print(os);
    }
    friend ostream& operator<< (ostream& os, const YN& wn)
    {
        wn.print(os);
        return os;
    }
};

template <class XN, class XA>
class YA : public XA
{
public:    
    YA() {};
    void print(ostream &os) const
    {
        os << "YA<XN,XA>::print() " << endl;
        XA::print(os);
    }
    
    friend ostream& operator<<(ostream& os, const YA &wa)
    {
        wa.print(os);
        return os;
    }
};


template<class XN, class XA>
class XBase : public Base< YN<XN, XA>, YA<XN, XA> >
{
public:
    typedef     Base< YN<XN,XA>, YA<XN,XA> >    Net;
    typedef     Net::n_iter          n_iter;
    XBase() {};
};


class MyClass
{
public:
  struct ZN
  {
    void print(ostream &os) const
      {
        os << "MyClass::ZN::print()" << endl;
      }
    inline friend ostream& operator<<(ostream& os, const MyClass::ZN& nd)
      {
        nd.print(os);
        return os;
      }
  };
  struct ZA
  {
    void print(ostream& os) const
      {
        os << "MyClass::ZA::print()" << endl;
      }
    inline friend ostream& operator<<(ostream& os, const MyClass::ZA& ar)
      {
        ar.print(os);
        return os;
      }
  };

  typedef XBase<ZN,ZA>                    MyXBase;
  typedef MyXBase::n_iter                 my_n_iter;
  MyXBase                                 xbase;
};

main ()
{
  MyClass mine;
  MyClass::my_n_iter  n1, n2, n3, n4;

  n1 = mine.xbase.new_n();
  n2 = mine.xbase.new_n();
  n3 = mine.xbase.new_n();
  n4 = mine.xbase.new_n();
  
  cout << *n1 << endl;
  cout << *n2 << endl;
  cout << *n3 << endl;
  cout << *n4 << endl;
  
  mine.xbase.del_n(n1);
  mine.xbase.del_n(n2);
  mine.xbase.del_n(n3);
  mine.xbase.del_n(n4);
}


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