c++/446: gcc egcs-1.1.2(Linux) crashes compiling access totemplate class data

Andrius andriusj@matfys.lth.se
Sat Aug 5 18:16:00 GMT 2000


The following reply was made to PR c++/446; it has been noted by GNATS.

From: Andrius <andriusj@matfys.lth.se>
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/446: gcc egcs-1.1.2(Linux) crashes compiling access to
 template class data
Date: Sun, 6 Aug 2000 03:12:22 +0200 (MET DST)

 Hello!
 
 I want to report a round way, that is different from and is more
 acceptable than the one I mentioned in my report. I will write it
 specificly for my example. When the method looks like
 
 template<int Dim>
 void TDerived<Dim>::Identify() const
 {
   printf("My name is '%s'. Value = %d\n",tBase::Name,x);
 }
 
 and the type TDerived<Dim>::tBase is 
 typedef TObject<TDerived<Dim> >  tBase;
 
 the compiler has no problem to create the code, which works.
 
 
 Another round-way is to access the static data not directly, but via
 a method in the base class. That is, if we define
 
 template<class T>
 const char *TObject<T>::GetName() const { return Name; }
 
 and
 
 template<int Dim>
 void TDerived<Dim>::Identify() const
 { printf("My name is '%s'. Value = %d\n",GetName(),x); }
 
 compiler has no problem to create functional code.
 
 If the [previously] reported code is used, the compiler seems to get
 confused about the location of a static variable.
 
 I hope these additions will help to detect the problem.
 With best wishes,
 Andrius
 
 
 On 5 Aug 2000 gcc-gnats@gcc.gnu.org wrote:
 
 > Thank you very much for your problem report.
 > It has the internal identification `c++/446'.
 > The individual assigned to look at your
 > report is: unassigned. 
 > 
 > >Category:       c++
 > >Responsible:    unassigned
 > >Synopsis:       gcc egcs-1.1.2(Linux) crashes compiling access to template class data
 > >Arrival-Date:   Sat Aug 05 14:36:01 PDT 2000
 > 
 


More information about the Gcc-prs mailing list