This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/1731: Internal compiler error 191 for inherited overloaded operator[] on NULL
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1731: Internal compiler error 191 for inherited overloaded operator[] on NULL
- From: C dot vanReeuwijk at twi dot tudelft dot nl
- Date: 22 Jan 2001 17:45:59 -0000
- Reply-To: C dot vanReeuwijk at twi dot tudelft dot nl
>Number: 1731
>Category: c++
>Synopsis: Internal compiler error 191 for inherited overloaded operator[] on NULL
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Mon Jan 22 09:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Kees van Reeuwijk
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Debian linux 2.2
>Description:
This is a refinement of my bug report c++/1065 of
december 2000: I have simplified the example program considerably.
The following C++ program causes an internal compiler error:
--------
class ShapeBase
{
public:
int& operator[]( const int i ) const { 0; }
};
class ShapeD1: public ShapeBase
{
};
int main( int argc, char *argv[] )
{
int n = (*(ShapeD1 *) 0)[0];
} ---------------
The fact that operator[] is inherited is important:
replacing ShapeD1 with ShapeBase in main() causes the
problem to go away.
It may be argued that the shown program is incorrect, since it tries to use a NULL pointer, but that's not a reason for an ICE. Moreover, constant propagation by the
compiler can cause the same situation and hence the same ICE.
>How-To-Repeat:
Compile the program above. No special flags are necessary.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: