This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/18378] New: ICE when returning a copy of a packed member


Defining a class method which returns a copy of one of its members, and this 
member is declared "packed", and this member is from another class type, causes 
an internal compiler error when this method is called.

The bug was verified on both gcc 3.4.2 and 3.4.3, on i686-linux and powerpc-
linux.

The following simple program will crash g++ when compiled with -DSHOW_ICE.

---------------------------------------------------------------------------

class A
{
public:
    int i;

    A() {}
    A(const A& a) { i = a.i; }
};

class B
{
#ifdef SHOW_ICE
    A a __attribute__((packed));
#else
    A a;
#endif

public:
    B() {}
    A GetA() { return a; }
};

int main()
{
    B b;
    return b.GetA().i;
}

---------------------------------------------------------------------------

Jean-Denis Boyer,
Mediatrix Telecom Inc.

-- 
           Summary: ICE when returning a copy of a packed member
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdboyer at mediatrix dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18378


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]