Bug 14477 - [3.4 Regression] Cannot compile pooma-gcc (regression)
Summary: [3.4 Regression] Cannot compile pooma-gcc (regression)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.0
: P1 critical
Target Milestone: 3.4.0
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code, patch
: 14469 14527 14584 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-08 08:19 UTC by Peter Schmid
Modified: 2004-09-09 23:40 UTC (History)
7 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.0 3.3.1
Known to fail:
Last reconfirmed: 2004-03-08 14:56:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Schmid 2004-03-08 08:19:39 UTC
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);  
}
Comment 1 Andrew Pinski 2004-03-08 14:30:56 UTC
This works for me on the mainline (20040308).
Comment 2 Volker Reichelt 2004-03-08 14:56:33 UTC
Reduced testcase (segfaults when compiled with "-O2 -fno-default-inline"):

=======================================
struct A
{
  A();
};

struct B
{
  B(const A*);
};

struct C
{
  B b;
  C(int) : b(new A) {}
};

C c(0);
=======================================
Comment 3 Volker Reichelt 2004-03-08 15:36:28 UTC
*** Bug 14469 has been marked as a duplicate of this bug. ***
Comment 4 Volker Reichelt 2004-03-08 22:42:56 UTC
Jason, your patch

http://gcc.gnu.org/ml/gcc-cvs/2004-03/msg00088.html

seems to be responsible for the regression.
Could you please have a look?
Comment 5 Eric Botcazou 2004-03-09 20:42:22 UTC
This is a C++ bug then.
Comment 6 Richard Henderson 2004-03-10 23:53:39 UTC
Mine.
Comment 7 Richard Henderson 2004-03-10 23:54:22 UTC
Not a c++ bug.
Comment 8 Mark Mitchell 2004-03-11 03:30:06 UTC
Looks good.  Check it in.  Thanks.
Comment 9 Wolfgang Bangerth 2004-03-11 15:44:31 UTC
Mark, what PR was your last comment #8 meant for? 
Comment 10 CVS Commits 2004-03-11 23:08:54 UTC
Subject: Bug 14477

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rth@gcc.gnu.org	2004-03-11 23:08:36

Modified files:
	gcc            : ChangeLog except.c 
Added files:
	gcc/testsuite/g++.dg/opt: eh1.C 

Log message:
	PR middle-end/14477
	* except.c (remove_unreachable_regions): Look thru CALL_PLACEHOLDER.
	* g++.dg/opt/eh1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.331&r2=2.2326.2.332
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.256.2.2&r2=1.256.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/eh1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 11 Richard Henderson 2004-03-11 23:20:24 UTC
Fixed.
Comment 12 Volker Reichelt 2004-03-16 02:36:30 UTC
*** Bug 14584 has been marked as a duplicate of this bug. ***
Comment 13 Jakub Jelinek 2004-03-16 16:08:57 UTC
*** Bug 14527 has been marked as a duplicate of this bug. ***