GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 8031 - ICE in comptypes, at cp/typeck.c:913
Summary: ICE in comptypes, at cp/typeck.c:913
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P2 critical
Target Milestone: ---
Assignee: Gabriel Dos Reis
URL:
Keywords: ice-on-invalid-code
: 7994 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-09-25 03:46 UTC by Václav Zeman
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host: i386-unknown-freebsd4.6
Target: i386-unknown-freebsd4.6
Build: i386-unknown-freebsd4.6
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Václav Zeman 2002-09-25 03:46:03 UTC
testcase-cast.cxx: In member function `virtual bool B::f(const A*)':
testcase-cast.cxx:17: error: cannot convert from base `A' to derived type `B'
   via virtual base `A'
testcase-cast.cxx:17: internal compiler error: in comptypes, at cp/typeck.c:913
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
3.3 20020925 (experimental)

Environment:
System: FreeBSD logout.sh.cvut.cz 4.6-STABLE FreeBSD 4.6-STABLE #0: Thu Aug 1 01:02:04 CEST 2002 root@logout.sh.cvut.cz:/usr/src/sys/compile/logout i386


	
host: i386-unknown-freebsd4.6
build: i386-unknown-freebsd4.6
target: i386-unknown-freebsd4.6
configured with: ../srcdir/configure --enable-threads --enable-languages=c,c++ --enable-version-specific-runtime-libs --prefix=/home/4/wilx --with-arch=i686 --with-cpu=i686 --enable-dwarf2 : (reconfigured) ../srcdir/configure --enable-threads --enable-languages=c,c++ --enable-version-specific-runtime-libs --prefix=/home/4/wilx --with-arch=i686 --with-cpu=i686 --enable-dwarf2

How-To-Repeat:
#include <typeinfo>

class A {
public:
    virtual bool f(const A* a) = 0;
};

class B : virtual public A {
    char ch;
public:
    virtual bool f(const A* a);
};

bool B::f(const A* a)
{
    if (typeid(a) == typeid(B))
        if (ch == static_cast<const B&>(*a).ch)
            return true;
    return false;
}
Comment 1 Kriang Lerdsuwanakij 2002-09-26 08:09:49 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.  The code is illegal, dynamic_cast should be used instead of static_cast.
Comment 2 Volker Reichelt 2002-10-27 17:54:45 UTC
From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, V.Haisman@sh.cvut.cz, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8031: ICE in comptypes, at cp/typeck.c:913
Date: Sun, 27 Oct 2002 17:54:45 +0200

 Hi,
 
 before the ICE g++ emits an error message, so that we'll see a
 "confused by earlier errors, bailing out" message instead in the release
 version (as in gcc 3.1 for example).
 
 However, gcc 3.0.x and gcc 2.95.x could handle this situation without
 such a message. So this is a slight regression.
 
 Greetings,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8031
 
 
Comment 3 Gabriel Dos Reis 2002-12-13 13:13:01 UTC
Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-Why: Working a fix.
Comment 4 Gabriel Dos Reis 2002-12-13 14:06:02 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed with:
    2002-12-13  Gabriel Dos Reis  <gdr@integrable-solutions.net>
    
    	PR C++/8031
    	* cvt.c (convert_to_pointer_force): Don't try comparing against 
    	erronous type.