[Bug c++/26455] New: g++ 3.x ICE on typeid(typeid(*object))
com dot d2 at free dot fr
gcc-bugzilla@gcc.gnu.org
Fri Feb 24 12:38:00 GMT 2006
The code below generates an ICE with g++ 3.3 (debian stable),
g++ 3.4 (debian testing):
------------------------------------------------
[pollindd] ~ >g++-3.3 -c ice-typeid.cc
ice-typeid.cc: In function `int bug5(BaseB*)':
ice-typeid.cc:43: internal compiler error: in expand_expr, at expr.c:8833
Please submit a full bug ...
[pollindd] ~ >g++-3.4 -c ice-typeid.cc
ice-typeid.cc: In function `int bug5(BaseB*)':
ice-typeid.cc:43: internal compiler error: in expand_expr_real, at
expr.c:8469
Please submit a full bug report...
------------------------------------------------
It works well with g++ 2.95.4 (debian).
Maybe related to bug #25357.
------------------------------------------------
[pollindd] ~ >g++-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
[pollindd] ~ >g++-3.3 -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.6/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--enable-__cxa_atexit --with-system-zlib --enable-nls
--without-included-gettext --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.6 (Debian 1:3.3.6-5)
------------------------------------------------
Code follows. Command line:
g++-3.x -c ice-typeid.cc
Optimisation flag seems to have no impact (same problem with
-O3). Likewise for -Wall. It works on more complicated code (?!)... but it's
hard to see where the fix is introduced.
------------------------------------------------
#include <typeinfo>
class BaseB
{
public:
virtual ~BaseB() {}
};
#if BUG == 1
const char* bug1(BaseB const* o)
{
return typeid(typeid(*o)).name();
}
#elif BUG == 2
const std::type_info & bug2(BaseB const* o)
{
return typeid(typeid(*o));
}
#elif BUG == 3
const char* bug3(BaseB * o)
{
return typeid(typeid(*o)).name();
}
#elif BUG == 4
const std::type_info & bug4(BaseB * o)
{
return typeid(typeid(*o));
}
#else
int bug5(BaseB * o)
{
int i;
return (typeid(typeid(*o)) == typeid(i));
}
#endif
------------------------------------------------
--
Summary: g++ 3.x ICE on typeid(typeid(*object))
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: com dot d2 at free dot fr
GCC build triplet: i486-pc-linux-gnu
GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26455
More information about the Gcc-bugs
mailing list