This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error.
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Internal compiler error.
- From: Gary Beckmann <gary at radionics dot com>
- Date: Tue, 7 Dec 1999 12:28:06 -0500
--JIxgvRY1ZW
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
> uname -a
Linux galileo 2.2.5-15smp #1 SMP Mon Apr 19 22:43:28 EDT 1999 i686 unknown
> g++ -v --save-temps broken.cxx
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ broken.cxx broken.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++-2
/usr/local/include
/usr/i386-redhat-linux/include
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus broken.ii -quiet -dumpbase broken.cc -version -o broken.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386-redhat-linux) compiled by GNU C version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
broken.cxx: In function `int main()':
broken.cxx:64: Internal compiler error.
broken.cxx:64: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
broken.cxx:64: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.
In the file broken.cxx (attached) I note a two spots where changes
will not cause the internal error.
----------------------------------------------------------------------
Gary Beckmann | e-mail: gbeckmann@radionics.com
RADIONICS | or: gary.beckmann@acm.org
22 Terry Ave. | telephone: (781)238-0600
Burlington, MA 01803 | fax: (781)238-0606
USA |
----------------------------------------------------------------------
--JIxgvRY1ZW
Content-Type: text/plain
Content-Description: Program source.
Content-Disposition: inline;
filename="broken.cxx"
Content-Transfer-Encoding: 7bit
/*
Submitter: Gary Beckmann <gary@radionics.com>
Note: locations are marked with "@@" and the number.
Problems:
1) Through a programming error, the specialization was stated
explicitly. Compiler announces internal error at site marked
@@2.
2) If the member function equals is used instead of the friend
operator==, then no crash, no error. Is it masked?
*/
template <class T> class type1
{
public:
type1<T> invert() const;
};
template <class T> class type2
{
public:
int equals(const type2<T> &vec) const;
template <class S> friend int operator==(const type2<S> &lhs,
const type2<S> &rhs);
};
template<class T> type1<T> type1<T>::invert() const
{
type1<T> tmp;
// @@1
// The error in the code. If this double specialization is used instead
// of the T then the compiler crashes.
type2<double> trans;
// type2<T> trans;
return type1<T>();
}
template<class T> int type2<T>::equals(const type2<T> & vec) const
{
return 1;
}
template<class T> int operator==(const type2<T> &lhs, const type2<T> &rhs)
{
return lhs.equals(rhs);
}
int main()
{
type2<double> a;
type2<double> b;
// @@2
// hide the error. If the equals member function is used instead of the
// operator==, with the above listed error in the code, the compiler will
// not crash.
// if (a.equals(b))
if (a == b)
{
}
return 0;
};
--JIxgvRY1ZW
Content-Type: text/plain
Content-Description: Compiler output.
Content-Disposition: inline;
filename="broken.ii"
Content-Transfer-Encoding: 7bit
# 1 "broken.cxx"
template <class T> class type1
{
public:
type1<T> invert() const;
};
template <class T> class type2
{
public:
int equals(const type2<T> &vec) const;
template <class S> friend int operator==(const type2<S> &lhs,
const type2<S> &rhs);
};
template<class T> type1<T> type1<T>::invert() const
{
type1<T> tmp;
type2<double> trans;
return type1<T>();
}
template<class T> int type2<T>::equals(const type2<T> & vec) const
{
return 1;
}
template<class T> int operator==(const type2<T> &lhs, const type2<T> &rhs)
{
return lhs.equals(rhs);
}
int main()
{
type2<double> a;
type2<double> b;
if (a == b)
{
}
return 0;
};
--JIxgvRY1ZW
Content-Type: text/plain
Content-Description: Compiler output.
Content-Disposition: inline;
filename="broken.s"
Content-Transfer-Encoding: 7bit
.file "broken.cxx"
.version "01.01"
gcc2_compiled.:
--JIxgvRY1ZW--