public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: massimo.bombino@icn.siemens.it
To: gcc-gnats@gcc.gnu.org
Subject: c++/8668: ICE 19970302 on trivial code
Date: Sat, 30 Nov 2002 20:16:00 -0000	[thread overview]
Message-ID: <20021121120504.30086.qmail@sources.redhat.com> (raw)


>Number:         8668
>Category:       c++
>Synopsis:       ICE 19970302 on trivial code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 21 04:06:05 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;
}


             reply	other threads:[~2002-11-21 12:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-30 20:16 massimo.bombino [this message]
2002-11-30 20:57 paolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021121120504.30086.qmail@sources.redhat.com \
    --to=massimo.bombino@icn.siemens.it \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).