You are now de-referencing NULL with *myBlk. You have to create a block to be 
able to assign to it. Either make it BlkType myBlk; or BlkType* myBlk = new 
BlkType(); I also assume your "condition1" includes a check blk != NULL?

Andreas

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Mahmood Naderan
Sent: 12 April 2012 06:47
To: gem5 users mailing list
Subject: [gem5-users] backup a BlkType (c++ question)

Dear all,
Maybe this a simple c++ question but will be thankful if you help.
I want to create a copy of a blk. To do that, I wrote:

    BlkType *blk = tags->findBlock(pkt->getAddr());
    BlkType *myBlk=0;
    if ( condition1 ) {
       *myBlk = *blk;
    }

this compiles however in the execution, the '=' crash:

    const CacheBlk& operator=(const CacheBlk& rhs)
    {
        asid = rhs.asid;
        tag = rhs.tag;
        data = rhs.data;
        size = rhs.size;
        status = rhs.status;
        whenReady = rhs.whenReady;
        set = rhs.set;
        refCount = rhs.refCount;
        return *this;
    }

This solution works with standarnd types (like int) but i don't know
why it is not applicable to this user defined type.

Can you help?
--
// Naderan *Mahmood;
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.

_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to