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]
Other format: [Raw text]

[Bug optimization/14477] New: Cannot compile pooma-gcc (regression)


I cannot compile the file src/Layout/DynamicLayout.cmpl.cpp from the pooma-gcc  
distribution with the default flags for the command line. It used to work a 
week ago when I lasted tried it. When I try to compile the attached file t.C, a 
reduced version of DynamicLayout.cmpl.cpp, I get:  
  
g++ -v -c -O2 -fno-default-inline  t.C -pedantic -funroll-loops -save-temps  
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs  
Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c 
++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug  
Thread model: posix  
gcc version 3.4.0 20040306 (prerelease)  
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E -quiet -v  
-D_GNU_SOURCE t.C -mtune=pentiumpro -pedantic -fno-default-inline  
-funroll-loops -O2 -o t.ii  
ignoring nonexistent directory "NONE/include"  
ignoring nonexistent directory "/usr/local/lib/gcc/ 
i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include"  
#include "..." search starts here:  
#include <...> search starts here:  
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0  
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/ 
i686-pc-linux-gnu  
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/ 
backward  
 /usr/local/include  
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include  
 /usr/include  
End of search list.  
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -fpreprocessed t.ii  
-quiet -dumpbase t.C -mtune=pentiumpro -auxbase t -O2 -pedantic -version  
-fno-default-inline -funroll-loops -o t.s  
GNU C++ version 3.4.0 20040306 (prerelease) (i686-pc-linux-gnu)  
	compiled by GNU C version 3.4.0 20040306 (prerelease).  
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64274  
t.C: In constructor `DataBlockPtr<T, BoundsChecked>::DataBlockPtr(size_t) [with  
T = int, bool BoundsChecked =  false]':  
t.C:366: internal compiler error: Segmentation fault  
Please submit a full bug report,  
with preprocessed source if appropriate.  
See <URL:http://gcc.gnu.org/bugs.html> for instructions.  
  
Source file t.C  
template<int Dim>  
class Loc;  
  
template<int Dim>  
class Interval;  
  
template<int Dim>  
class Range;  
  
typedef unsigned int size_t;  
template <class Dom>  
class DomainIterator  
{  
public:  
  DomainIterator()  
    : index_m(0)  
    {  
    }  
private:  
  int index_m;  
};  
  
template <class T>  
struct SizeTypePromotion  
{  
  typedef T Type_t;  
};  
  
template <>  
struct SizeTypePromotion<int>  
{  
  typedef long Type_t;  
};  
  
template <>  
struct SizeTypePromotion<float>  
{   
  typedef double Type_t;  
};  
  
template<class DomT, class T, int Dim>  
struct DomainTraitsDomain  
{  
};  
  
template<class DomT, class T>  
struct DomainTraitsDomain<DomT, T, 1>  
{  
  typedef typename SizeTypePromotion<T>::Type_t Size_t;  
  typedef    T Element_t;  
  typedef DomT Domain_t;  
  
  enum { domain = 1 };  
  enum { dimensions = 1 };  
  
  inline  
  static Element_t getFirst(const Domain_t &d)  { return d.first(); }  
  static Element_t getStride(const Domain_t &d) { return d.stride(); }  
  inline  
  static Size_t    getLength(const Domain_t &d) { return d.length(); }  
};  
  
template<class DomT, class T, class NewDom1T>  
struct DomainTraitsScalar  
{  
};  
  
template<class T>  
struct DomainTraits : public DomainTraitsScalar<T, T, T> { };  
  
template<class DT>  
class DomainBase  
{  
public:  
  typedef typename DT::Element_t     Element_t;  
  typedef typename DT::Size_t        Size_t;  
  typedef typename DT::Domain_t      Domain_t;  
  typedef typename DT::OneDomain_t   OneDomain_t;  
  typedef typename DT::Storage_t     Storage_t;  
  
  enum { domain          = DT::domain };  
  enum { dimensions      = DT::dimensions };  
  enum { loopAware       = DT::loopAware };  
  
  
  inline  
  Domain_t &unwrap() { return *static_cast<Domain_t *>(this); }  
protected:  
  Storage_t domain_m;  
};  
  
template<int Dim, class DT>  
class Domain : public DomainBase<DT>  
{  
};  
  
template<class DT, class ST, class T, class UT, bool wildcard>  
struct SetDomainFunctor  
{  
  inline  
  static void setDomain(ST &domain_m, const T &newdom) {  
    DT::setDomain(domain_m, newdom);  
  }  
};  
  
  
template<class DT>  
class Domain<1, DT> : public DomainBase<DT>  
{  
public:  
  
  typedef typename DomainBase<DT>::Element_t    Element_t;  
  typedef typename DomainBase<DT>::Size_t       Size_t;  
  typedef typename DomainBase<DT>::Domain_t     Domain_t;  
  typedef typename DomainBase<DT>::OneDomain_t  OneDomain_t;  
  typedef typename DomainBase<DT>::Storage_t    Storage_t;  
  
  enum { domain          = DomainBase<DT>::domain };  
  enum { dimensions      = DomainBase<DT>::dimensions };  
  enum { loopAware       = DomainBase<DT>::loopAware };  
  
  inline  
  Domain() { }  
  
  inline  
  Element_t first() const { return DT::first(this->domain_m); }  
  inline  
  Element_t last() const { return DT::last(this->domain_m); }  
  
  // return the stride of the domain  
  inline  
  Element_t stride() const { return DT::stride(this->domain_m); }  
    
  // return the length of the domain, which is the number of points  
  // (including the endpoints) for the domain  
  inline  
  Size_t length() const { return DT::length(this->domain_m); }  
  
  template<class T>  
  inline  
  void setDomain(const T &newdom) {  
    SetDomainFunctor<DT,Storage_t,T,T,(DomainTraits<T>::wildcard==1)>::  
      setDomain(this->domain_m, newdom);  
  }  
  
};  
  
template<>  
struct DomainTraits< Interval<1> >  
  : public DomainTraitsDomain<Interval<1>, int, 1>  
{  
  typedef Interval<1> OneDomain_t;  
  typedef Interval<1> PointDomain_t;  
  typedef Interval<1> BlockDomain_t;  
  typedef Loc<1>      AskDomain_t;  
  
  typedef Element_t Storage_t[2];  
  
  enum { sliceDimensions = 1 };  
  enum { loopAware = 0 };  
  enum { wildcard = 0 };  
  
  inline  
  static Element_t first(const Storage_t &d)  { return d[0]; }  
  inline  
  static Element_t last(const Storage_t &d)   { return d[0] + d[1] - 1; }  
};  
  
  
  
template<class RT, class CT, int DS>  
struct CombineDomain {  
  static void combine(RT &rt, const CT& ct) {  
    const int D = DomainTraits<CT>::dimensions;  
    for (int i=0; i < D; ++i)  
      DomainTraits<RT>::getDomain(rt, DS + i).setDomain(  
	                        DomainTraits<CT>::getDomain(ct, i));  
  }  
};  
template<class T1>  
struct NewDomain1  
{  
  template<class RT>  
  inline static RT &fill(RT &retval, const T1 &a)  
    {  
      CombineDomain<RT,T1,0>::combine(retval,a);  
      return retval;  
    }  
  
};  
  
template<int Dim>  
class Interval : public Domain<Dim, DomainTraits<Interval<Dim> > >  
{  
public:  
};  
  
  
template<>  
class Interval<1> : public Domain<1, DomainTraits<Interval<1> > >  
{  
};  
  
template<int Dim>  
struct DomainTraits< Range<Dim> >  
  : public DomainTraitsDomain<Range<Dim>, int, Dim>  
{  
};  
  
template<>  
struct DomainTraits< Range<1> >  
  : public DomainTraitsDomain<Range<1>, int, 1>  
{  
   // other necessary typedefs  
  typedef Range<1>    OneDomain_t;  
  typedef Range<1>    PointDomain_t;  
  typedef Interval<1> BlockDomain_t;  
  typedef Loc<1>      AskDomain_t;  
  
  typedef Element_t Storage_t[3];  
  
  // other necessary enums  
  enum { sliceDimensions = 1 };  
  enum { loopAware = 0 };  
  enum { wildcard = 0 };  
  
  // return size, endpoint, stride, and loop information  
  static Element_t first(const Storage_t &d)  { return d[0]; }  
  static Element_t last(const Storage_t &d)   { return d[0] + (d[1]-1)*d[2]; }  
  static Element_t stride(const Storage_t &d) { return d[2]; }  
  static Element_t length(const Storage_t &d) { return d[1]; }  
  static OneDomain_t &getDomain(Domain_t &d, int) { return d; }  
  static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; }  
  
  static void initializeStorage(Storage_t &dom) {  
  }  
  
};  
  
template<int Dim>  
class Range : public Domain<Dim, DomainTraits<Range<Dim> > >  
{  
};  
  
template<>  
class Range<1> : public Domain<1, DomainTraits<Range<1> > >  
{  
public:  
  template<class T1, class T2, class T3>  
  Range(const T1 &m, const T2 &n, const T3 &s)  
    : Domain<1, DomainTraits<Range<1> > >() {  
   }  
};  
  
class RefCounted   
{  
public:  
  RefCounted()   
    : count_m(0)   
    { }  
  
  RefCounted(const RefCounted &)   
    : count_m(0)   
    { }  
  
private:  
  
  RefCounted & operator=(const RefCounted &); // UNIMPLEMENTED  
  
  int count_m;  
};  
  
template <class T>  
class RefCountedPtr  
{  
public:  
  typedef RefCountedPtr<T> This_t;  
    
  RefCountedPtr() : ptr_m(0) { }  
  RefCountedPtr(T * const pT)  
    : ptr_m(pT)   
    { }  
  
  RefCountedPtr(const This_t &model)  
    : ptr_m(model.ptr_m)  
    { }  
  
private:  
  
  T * ptr_m;  
  
};  
  
template <class T>  
class RefBlockController : public RefCounted  
{  
public:   
  explicit   
  RefBlockController(size_t size)  
    : dealloc_m(false)  
  {  
    reallocateStorage(size, false);  
  }  
  
private:  
  
  void reallocateStorage(size_t newsize, bool copyold = false)  
  {  
    if (newsize > 0)  
      {  
	int nsize = newsize * sizeof(T);  
	char *tmp = new char[nsize];  
  
      }  
  }  
  bool dealloc_m;  
};                              // RefBlockController  
  
template <class T,   
  bool BoundsChecked=false,  
  class Controller=RefBlockController<T> >  
class RefCountedBlockPtr  
{  
public:  
  inline RefCountedBlockPtr()  
    { }  
  
  inline explicit RefCountedBlockPtr(size_t size)  
    : blockControllerPtr_m(new Controller(size))  
  { }  
  
protected:  
  
  RefCountedPtr<Controller> blockControllerPtr_m;  
};  
  
template <class T>   
class DataBlockController   
  : public RefBlockController<T>  
{  
public:  
  typedef RefBlockController<T> Base_t;  
  
  explicit   
  DataBlockController(size_t size)  
    : Base_t(size)  
  { }  
    
};  
  
template <class T,   
          bool BoundsChecked=false>  
class DataBlockPtr   
  : public RefCountedBlockPtr<T,BoundsChecked,DataBlockController<T> >  
{  
public:  
    
  typedef DataBlockController<T> Controller_t;  
  typedef RefCountedBlockPtr<T,BoundsChecked,Controller_t> RCBPtr_t;  
  
  DataBlockPtr() : RCBPtr_t()  
  { }  
  
  explicit DataBlockPtr(size_t size)  
    : RCBPtr_t(size)  
  { }  
  
};   
  
template<class T>  
class IndirectionList  
{  
public:  
  
  typedef IndirectionList<T>  This_t;  
  typedef T                   Element_t;  
  typedef IndirectionList<T>  Domain_t;  
  typedef DataBlockPtr<T>     Storage_t;  
  
  typedef long                Size_t;  
  
  
  IndirectionList()  
    : size_m(0)  
    {  
    }  
  
  IndirectionList(const This_t &a)  
    : iList_m(a.iList_m), size_m(a.size_m)  
    {  
    }  
  
  template<class T1>  
  IndirectionList(const T1 &first, const T1 &stride, Size_t num)  
    : iList_m(num), size_m(num)  
    {  
    }  
  template<class T1>  
  explicit IndirectionList(const T1 &a)  
    : iList_m(a.engine().dataBlock()), size_m(a.domain().size())  
    {  
    }  
  
private:  
  
  Storage_t iList_m;  
  Size_t size_m;  
};  
  
template<int Dim> class Grid;  
template<int Dim> class Interval;  
  
template<int Dim>  
struct DomainTraits< Grid<Dim> >  
  : public DomainTraitsDomain<Grid<Dim>, int, Dim>  
{  
};  
  
template<>  
struct DomainTraits< Grid<1> >  
  : public DomainTraitsDomain<Grid<1>, int, 1>  
{  
  typedef Grid<1>     OneDomain_t;  
  typedef Interval<1> BlockDomain_t;  
  typedef Loc<1>      AskDomain_t;  
  
  typedef IndirectionList<Element_t> Storage_t;  
  
  enum { sliceDimensions = 1 };  
  enum { loopAware = 0 };  
  enum { wildcard = 0 };  
  
  static OneDomain_t &getDomain(Domain_t &d, int) { return d; }  
  static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; }  
  static void initializeStorage(Storage_t &) { }  
  
  template<class T>  
  static void setDomain(Storage_t &dom, const T &newdom) {  
    dom = Storage_t(DomainTraits<T>::getFirst(newdom),  
		    DomainTraits<T>::getStride(newdom),  
		    DomainTraits<T>::getLength(newdom));  
  }  
  template<int Dim>  
  static void setDomain(Storage_t &dom, const Grid<Dim> &newdom) {  
  }  
  
};  
template<int Dim>  
class Grid : public Domain<Dim, DomainTraits<Grid<Dim> > >  
{  
};  
  
template<>  
class Grid<1> : public Domain<1, DomainTraits<Grid<1> > >  
{  
public:  
  
  Grid(const Grid<1> &a) {  
  }  
  template<class T1>  
  explicit Grid(const T1 &a) {  
    NewDomain1<T1>::fill(*this, a);  
  }  
};  
  
  
Grid<1> makeUniformGrid(const Interval<1> &gdom, int nblocks)  
{  
      long blocksize= 0;  
      Range<1> ret(gdom.first(), gdom.last() + 1, blocksize);  
      return Grid<1>(ret);  
}

-- 
           Summary: Cannot compile pooma-gcc (regression)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schmid at snake dot iap dot physik dot tu-darmstadt dot
                    de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14477


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