This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25386] New: packed structs
- From: "nathan at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2005 09:38:50 -0000
- Subject: [Bug c++/25386] New: packed structs
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++.dg/ext/packed3.C fails on default packed targets.
I don't think this is the case. The questionable code (from the test
case) really is
struct Unpacked { int i; };
struct __attribute__ ((packed)) Packed
{
char c;
int i;
Unpacked u;
};
and the test expects that you cannot bind Packed::u to Unpacked& (error
expected), but that you can bind Packed::u::i to int& (not even a
warning expected). No warning is expected on the definition of Packed's
u member.
Not exactly. My problems are
(a) the above mentioned inconsistency in allowing binding to the whole
structure but not to its members, and
(b) on a default-packed target (or with -fpack-struct) getting reverse
behavior in allowing binding to Packed::u but not allowing binding to
Packed::u::i.
>% ah, I think that warning should only be given on non-default-packed
>> arches. Is this your problem Jan?
I think the warning should be given only if the base class does not
itself have the minimum alignment for the artchitecture. (So that you
would get the warning on a system that was packed by default if you used
a base class which was explicitly aligned on a wider boundary.)
--
Summary: packed structs
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nathan at gcc dot gnu dot org
GCC target triplet: *-*-netware*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25386