This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/2104: ice only if debuggging (-g) is enabled
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/2104: ice only if debuggging (-g) is enabled
- From: schmid at snake dot iap dot physik dot tu-darmstadt dot de
- Date: Mon, 26 Feb 2001 21:16:30 +0100
>Number: 2104
>Category: c++
>Synopsis: ice only if debuggging (-g) is enabled
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Mon Feb 26 11:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Peter Schmid
>Release: 3.0 20010223 (prerelease)
>Organization:
TU Darmstadt
>Environment:
System: Linux kiste 2.4.2 #34 Sun Feb 25 20:03:34 CET 2001 i686 unknown
Architecture: i686
GNU ld version 2.10.91 (with BFD 2.10.1.0.4)
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-long-long
>Description:
The following code tb.C, stripped-down from the file
testsuite/chris-jeffery-1.cpp from blitz-20000122 and <complex>,
generates an internal compiler error only if debugging information
(-g) is enabled, otherwise the code compiles without a problem.
G++-2.95.2 does crash with an internal error, regardless if -g is
added to the command line.
the command line.
>How-To-Repeat:
source file tb.C
/***************************************************************************
* blitz/array.h Declaration of the Array<P_numtype, N_rank> class
*
* $Id: array.h,v 1.2 1998/03/14 00:04:47 tveldhui Exp $
*
* Copyright (C) 1997-1999 Todd Veldhuizen <tveldhui@oonumerics.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. */
namespace std
{
// Forward declarations
template<typename _Tp> class complex;
template<> class complex<float>;
// 26.2.2 Primary template class complex
template<typename _Tp>
class complex
{
public:
typedef _Tp value_type;
complex(const _Tp& = _Tp(), const _Tp & = _Tp());
// Let's the compiler synthetize the copy constructor
// complex (const complex<_Tp>&);
template<typename _Up>
complex(const complex<_Up>&);
_Tp real() const;
_Tp imag() const;
complex<_Tp>& operator=(const _Tp&);
// Let's the compiler synthetize the
// copy and assignment operator
// complex<_Tp>& operator= (const complex<_Tp>&);
template<typename _Up>
complex<_Tp>& operator=(const complex<_Up>&);
private:
_Tp _M_real, _M_imag;
};
template<typename _Tp>
inline _Tp
complex<_Tp>::real() const { return _M_real; }
template<typename _Tp>
inline _Tp
complex<_Tp>::imag() const { return _M_imag; }
template<typename _Tp>
inline
complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
: _M_real(__r), _M_imag(__i) { }
template<typename _Tp>
template<typename _Up>
inline
complex<_Tp>::complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) { }
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator=(const _Tp& __t)
{
_M_real = __t;
_M_imag = _Tp();
return *this;
}
// Operators:
// Values
template<typename _Tp>
inline _Tp
real(const complex<_Tp>& __z)
{ return __z.real(); }
template<typename _Tp>
inline _Tp
imag(const complex<_Tp>& __z)
{ return __z.imag(); }
template<typename _Tp>
inline complex<_Tp>
conj(const complex<_Tp>& __z)
{ return complex<_Tp>(__z.real(), -__z.imag()); }
// 26.2.3 complex specializations
// complex<float> specialization
template<> class complex<float>
{
public:
typedef float value_type;
complex(float = 0.0f, float = 0.0f);
float real() const;
float imag() const;
// Let's the compiler synthetize the copy and assignment
// operator. It always does a pretty good job.
// complex& operator= (const complex&);
template<typename _Tp>
complex<float>&operator=(const complex<_Tp>&);
private:
typedef __complex__ float _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) { }
};
inline float
complex<float>::real() const
{ return __real__ _M_value; }
inline float
complex<float>::imag() const
{ return __imag__ _M_value; }
inline
complex<float>::complex(float r, float i)
{
__real__ _M_value = r;
__imag__ _M_value = i;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
} // namespace std
namespace blitz
{
using namespace std;
template<class T_array, class T_iterator = typename T_array::T_numtype*>
class ListInitializationSwitch {
public:
typedef typename T_array::T_numtype T_numtype;
ListInitializationSwitch(const ListInitializationSwitch<T_array>& lis)
: array_(lis.array_), value_(lis.value_),
wipeOnDestruct_(true)
{
lis.disable();
}
ListInitializationSwitch(T_array& array, T_numtype value)
: array_(array), value_(value), wipeOnDestruct_(true)
{ }
~ListInitializationSwitch()
{
if (wipeOnDestruct_)
array_.initialize(value_);
}
void disable() const
{
}
private:
ListInitializationSwitch();
protected:
T_array& array_;
T_numtype value_;
bool wipeOnDestruct_;
};
template<class P_numtype, int N_length>
class TinyVector {
public:
typedef P_numtype T_numtype;
TinyVector()
{ }
~TinyVector()
{ }
inline TinyVector(const TinyVector<P_numtype,N_length>& x);
inline TinyVector(T_numtype initValue);
T_numtype operator[](unsigned i) const
{
return data_[i];
}
T_numtype& operator[](unsigned i)
{
return data_[i];
}
private:
T_numtype data_[N_length];
};
template<class P_type>
class MemoryBlockReference {
};
template<int N_rank>
class GeneralArrayStorage {
};
template<class P_numtype, int N_rank>
class Array : public MemoryBlockReference<P_numtype>
{
public:
typedef P_numtype T_numtype;
typedef Array<T_numtype, N_rank> T_array;
explicit Array(int length0,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
: storage_(storage)
{
length_[0] = length0;
}
ListInitializationSwitch<T_array> operator=(T_numtype x)
{
return ListInitializationSwitch<T_array>(*this, x);
}
T_array& initialize(T_numtype);
protected:
GeneralArrayStorage<N_rank> storage_;
TinyVector<int, N_rank> length_;
};
}
using namespace blitz;
int main()
{
Array<complex<float>,1> test2(5) ;
test2 = complex<float>(3,3) ;
}
Compiling tb.C (debugging enabled)
g++ -v -c -W -Wall tb.C -save-temps -g
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-long-long
gcc version 3.0 20010223 (prerelease)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/cpp0 -lang-c++ -D_GNU_SOURCE -D__GNUG__=3 -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1 -W -Wall -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tb.C tb.ii
GNU CPP version 3.0 20010223 (prerelease) (cpplib) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
/usr/local/i686-pc-linux-gnu/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1plus -fpreprocessed tb.ii -quiet -dumpbase tb.C -g -W -Wall -version -o tb.s
GNU CPP version 3.0 20010223 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0 20010223 (prerelease) (i686-pc-linux-gnu)
compiled by GNU C version 3.0 20010221 (prerelease).
tb.C: In constructor `blitz::ListInitializationSwitch<T_array,
T_iterator>::ListInitializationSwitch(T_array&, typename T_array::T_numtype)
[with T_array = blitz::Array<std::complex<float>, 1>, T_iterator =
std::complex<float>*]':
tb.C:174: instantiated from `blitz::ListInitializationSwitch<T_array, T_iterator>::ListInitializationSwitch(T_array&, typename T_array::T_numtype) [with T_array = blitz::Array<std::complex<float>, 1>, T_iterator = std::complex<float>*]'
tb.C:254: instantiated from `blitz::ListInitializationSwitch<blitz::Array<P_numtype, N_rank>, P_numtype*> blitz::Array<P_numtype, N_rank>::operator=(P_numtype) [with P_numtype = std::complex<float>, int N_rank = 1]'
tb.C:271: instantiated from here
tb.C:174: Internal error: Segmentation fault
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Preprocessed source file tb.ii
# 18 "tb.C"
namespace std
{
template<typename _Tp> class complex;
template<> class complex<float>;
template<typename _Tp>
class complex
{
public:
typedef _Tp value_type;
complex(const _Tp& = _Tp(), const _Tp & = _Tp());
template<typename _Up>
complex(const complex<_Up>&);
_Tp real() const;
_Tp imag() const;
complex<_Tp>& operator=(const _Tp&);
template<typename _Up>
complex<_Tp>& operator=(const complex<_Up>&);
private:
_Tp _M_real, _M_imag;
};
template<typename _Tp>
inline _Tp
complex<_Tp>::real() const { return _M_real; }
template<typename _Tp>
inline _Tp
complex<_Tp>::imag() const { return _M_imag; }
template<typename _Tp>
inline
complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
: _M_real(__r), _M_imag(__i) { }
template<typename _Tp>
template<typename _Up>
inline
complex<_Tp>::complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) { }
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator=(const _Tp& __t)
{
_M_real = __t;
_M_imag = _Tp();
return *this;
}
template<typename _Tp>
inline _Tp
real(const complex<_Tp>& __z)
{ return __z.real(); }
template<typename _Tp>
inline _Tp
imag(const complex<_Tp>& __z)
{ return __z.imag(); }
template<typename _Tp>
inline complex<_Tp>
conj(const complex<_Tp>& __z)
{ return complex<_Tp>(__z.real(), -__z.imag()); }
template<> class complex<float>
{
public:
typedef float value_type;
complex(float = 0.0f, float = 0.0f);
float real() const;
float imag() const;
template<typename _Tp>
complex<float>&operator=(const complex<_Tp>&);
private:
typedef __complex__ float _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) { }
};
inline float
complex<float>::real() const
{ return __real__ _M_value; }
inline float
complex<float>::imag() const
{ return __imag__ _M_value; }
inline
complex<float>::complex(float r, float i)
{
__real__ _M_value = r;
__imag__ _M_value = i;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
}
namespace blitz
{
using namespace std;
template<class T_array, class T_iterator = typename T_array::T_numtype*>
class ListInitializationSwitch {
public:
typedef typename T_array::T_numtype T_numtype;
ListInitializationSwitch(const ListInitializationSwitch<T_array>& lis)
: array_(lis.array_), value_(lis.value_),
wipeOnDestruct_(true)
{
lis.disable();
}
ListInitializationSwitch(T_array& array, T_numtype value)
: array_(array), value_(value), wipeOnDestruct_(true)
{ }
~ListInitializationSwitch()
{
if (wipeOnDestruct_)
array_.initialize(value_);
}
void disable() const
{
}
private:
ListInitializationSwitch();
protected:
T_array& array_;
T_numtype value_;
bool wipeOnDestruct_;
};
template<class P_numtype, int N_length>
class TinyVector {
public:
typedef P_numtype T_numtype;
TinyVector()
{ }
~TinyVector()
{ }
inline TinyVector(const TinyVector<P_numtype,N_length>& x);
inline TinyVector(T_numtype initValue);
T_numtype operator[](unsigned i) const
{
return data_[i];
}
T_numtype& operator[](unsigned i)
{
return data_[i];
}
private:
T_numtype data_[N_length];
};
template<class P_type>
class MemoryBlockReference {
};
template<int N_rank>
class GeneralArrayStorage {
};
template<class P_numtype, int N_rank>
class Array : public MemoryBlockReference<P_numtype>
{
public:
typedef P_numtype T_numtype;
typedef Array<T_numtype, N_rank> T_array;
explicit Array(int length0,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
: storage_(storage)
{
length_[0] = length0;
}
ListInitializationSwitch<T_array> operator=(T_numtype x)
{
return ListInitializationSwitch<T_array>(*this, x);
}
T_array& initialize(T_numtype);
protected:
GeneralArrayStorage<N_rank> storage_;
TinyVector<int, N_rank> length_;
};
}
using namespace blitz;
int main()
{
Array<complex<float>,1> test2(5) ;
test2 = complex<float>(3,3) ;
}
Compiling tb.C (debugging turned off)
g++ -v -c -W -Wall tb.C
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-long-long
gcc version 3.0 20010223 (prerelease)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1 -W -Wall -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tb.C -D__GNUG__=3 -D_GNU_SOURCE -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase tb.C -W -Wall -version -o /tmp/cctCmR0P.s
GNU CPP version 3.0 20010223 (prerelease) (cpplib) (i386 Linux/ELF)
GNU CPP version 3.0 20010223 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0 20010223 (prerelease) (i686-pc-linux-gnu)
compiled by GNU C version 3.0 20010221 (prerelease).
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
/usr/local/i686-pc-linux-gnu/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o tb.o /tmp/cctCmR0P.s
GNU assembler version 2.10.91 (i686-pc-linux-gnu) using BFD version 2.10.1.0.4
Compiling tb.C (debugging turned on) by g++ 2.95.2
/usr/bin/g++ -v -c -W -Wall tb.C -g
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -g -W -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ tb.C /tmp/cc3Y73Ac.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++
/usr/local/include
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/../../../../i486-suse-linux/include
End of omitted list.
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cc1plus /tmp/cc3Y73Ac.ii -quiet -dumpbase tb.cc -g -W -Wall -version -o /tmp/cc2Edn3g.s
GNU C++ version 2.95.2 19991024 (release) (i486-suse-linux) compiled by GNU C version 2.95.2 19991024 (release).
tb.C: In method `class blitz::ListInitializationSwitch<blitz::Array<complex<float>,1>,complex<float> *> blitz::Array<complex<float>,1>::operator =(complex<float>)':
tb.C:271: instantiated from here
tb.C:254: Internal compiler error.
tb.C:254: Please submit a full bug report.
tb.C:254: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Compiling tb.C (debugging turned off) by g++ 2.95.2
/usr/bin/g++ -v -c -W -Wall tb.C
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -W -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ tb.C /tmp/ccTfzsUC.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++
/usr/local/include
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/../../../../i486-suse-linux/include
End of omitted list.
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cc1plus /tmp/ccTfzsUC.ii -quiet -dumpbase tb.cc -W -Wall -version -o /tmp/ccqbiK07.s
GNU C++ version 2.95.2 19991024 (release) (i486-suse-linux) compiled by GNU C version 2.95.2 19991024 (release).
tb.C: In method `class blitz::ListInitializationSwitch<blitz::Array<complex<float>,1>,complex<float> *> blitz::Array<complex<float>,1>::operator =(complex<float>)':
tb.C:271: instantiated from here
tb.C:254: Internal compiler error.
tb.C:254: Please submit a full bug report.
tb.C:254: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: