This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8667: ICE 19970302 on trivial code
- From: massimo dot bombino at icn dot siemens dot it
- To: gcc-gnats at gcc dot gnu dot org
- Date: 21 Nov 2002 12:01:49 -0000
- Subject: c++/8667: ICE 19970302 on trivial code
- Reply-to: massimo dot bombino at icn dot siemens dot it
>Number: 8667
>Category: c++
>Synopsis: ICE 19970302 on trivial code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 21 04:06:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Massimo Bombino
>Release: GCC 2.95.3-10
>Organization:
>Environment:
CygWin 1.3.15-1
WinXP R1
>Description:
A trivial code generate this ICE; only few simple classes are used
>How-To-Repeat:
g++ -o GNUBug GNUBug.c
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="GNUBug.c"
Content-Disposition: inline; filename="GNUBug.c"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <memory>
int MESG_SIZ;
class Bfp_AllIfs
{
public:
virtual void Msg_bcpbfp_aal2d_setup_req () = 0;
};
class Bfp_Coordination : public Bfp_AllIfs
{
private:
public:
Bfp_Coordination()
{
#if BOM_DEBUG
cout << "Costruttore Bfp_Coordination " << endl;
#endif
}
virtual ~Bfp_Coordination()
{
#if BOM_DEBUG
cout << "Distruttore Bfp_Coordination " << endl;
#endif
}
void Msg_bcpbfp_aal2d_setup_req (int MsgId, unsigned char * MsgData)
{
int Id;
unsigned char Data[MESG_SIZ];
Id=MsgId;
memcpy(Data, MsgData, MESG_SIZ);
#if BOM_DEBUG
cout << "Bfp_Coordination.Msg_bcpbfp_aal2d_setup_req() -> " << "Id = " << id << endl;
#endif
}
};
class ACE_Message
{
protected:
int id;
public:
ACE_Message(int code) //: id(code)
{
#if BOM_DEBUG
cout << "Costruttore ACE_Message -> " << "Id = " << id << endl;
#endif
}
virtual ~ACE_Message()
{
id = -1;
#if BOM_DEBUG
cout << "Distruttore ACE_Message -> " << "Id = " << id << endl;
#endif
}
};
class BOM_BfpMessage : public ACE_Message
{
public:
Bfp_AllIfs* ImplementationPtr_;
BOM_BfpMessage(int code, Bfp_AllIfs* ImplementationPtr) :
ACE_Message(code), ImplementationPtr_(ImplementationPtr)
{
#if BOM_DEBUG
cout << "Costruttore BOM_BfpMessage -> " << "Id = " << id << endl;
#endif
}
virtual ~BOM_BfpMessage()
{
id = -1;
#if BOM_DEBUG
cout << "Distruttore BOM_BfpMessage -> " << "Id = " << id << endl;
#endif
}
virtual void process_message()
{
#if BOM_DEBUG
cout << "BOM_BfpMessage.process_message -> " <<
"Id = " << id << endl;
#endif
}
};
class Msg_bcpbfp_aal2d_setup_req : public BOM_BfpMessage
{
private:
unsigned char Data[MESG_SIZ];
public:
Msg_bcpbfp_aal2d_setup_req(int code, Bfp_AllIfs* ImplementationPtr, unsigned char * MsgData) :
BOM_BfpMessage(code, ImplementationPtr)
{
memcpy(Data, MsgData, MESG_SIZ);
#if BOM_DEBUG
cout << "Costruttore Msg_bcpbfp_aal2d_setup_req -> " <<
"Id = " << id << endl;
#endif
}
virtual ~Msg_bcpbfp_aal2d_setup_req()
{
id = -1;
#if BOM_DEBUG
cout << "Distruttore Msg_bcpbfp_aal2d_setup_req -> " <<
"Id = " << id << endl;
#endif
}
void process_message()
{
#if BOM_DEBUG
cout << "Msg_bcpbfp_aal2d_setup_req->process_message()" << endl;
#endif
ImplementationPtr_-> Msg_bcpbfp_aal2d_setup_req();
}
};
int main(int argn, char **args)
{
time_t t1,t2;
struct tm* ts;
if (argn < 3)
{
cout << "Usage: " << args[0] << " <MESG_SIZ> <ITERATIONS>" << endl;
return -1;
}
int MESG_SIZ = atoi(args[1]);
long n = atol(args[2]);
Bfp_AllIfs* Bfp(new Bfp_Coordination());
t1 = time(NULL);
ts = localtime(&t1);
cout << "Inizio: " << ts->tm_hour << ":" << ts->tm_min << ":" << ts->tm_sec << endl;
for(long i=0;i<n;i++)
{
unsigned char Data[MESG_SIZ];
ACE_Message* Msg1(new Msg_bcpbfp_aal2d_setup_req(34, Bfp, Data));
// after ACE_TASK::getq()
BOM_BfpMessage* BfpMsg = dynamic_cast<BOM_BfpMessage*>(Msg1);
if (BfpMsg != 0)
{
BfpMsg->process_message();
}
else
{
cout << "Dynamic cast failed!" << endl;
}
delete Msg1;
}
t2 = time(NULL);
ts = localtime(&t2);
cout << "Fine: " << ts->tm_hour << ":" << ts->tm_min << ":" << ts->tm_sec << endl;
cout << n << " messages in " << (t2-t1) << " sec. (" << (n / (t2-t1)) << " msg/sec) " << endl;
return 0;
}