public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13983] New: packed attribute does not take effect when using typedef
@ 2004-02-02 16:54 bkramer at ciprico dot com
2004-02-02 16:56 ` [Bug c++/13983] " bkramer at ciprico dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: bkramer at ciprico dot com @ 2004-02-02 16:54 UTC (permalink / raw)
To: gcc-bugs
Reading specs from
/devel/new_compiler/engsrc/tools/linux/lib/gcc-lib/powerpc-wrs-vxworks/3.4.0/specs
Configured with: ../../src/gcc/configure --target=powerpc-wrs-vxworks
--prefix=/devel/gcc-vxworks --enable-languages=c,c++ --enable-thread=vxworks
--with-headers=/devel/Tornado/target/h --with-gnu-ld --with-gnu-as
--enable-altivec --enable-long-long
Thread model: vxworks
gcc version 3.4.0 20040130 (prerelease)
/devel/new_compiler/engsrc/tools/linux/bin/../libexec/gcc/powerpc-wrs-vxworks/3.4.0/cc1plus -E -quiet -nostdinc -v -I/devel/new_compiler/engsrc/tools/Tornado/target/config/all -I/devel/new_compiler/engsrc/tools/Tornado/target/src/config -I/devel/new_compiler/engsrc/tools/Tornado/target/src/drv -I/devel/new_compiler/engsrc/tools/Tornado/target/h -I/devel/new_compiler/engsrc/tools/Tornado/target/h/c++/3.4.0-O2 -iprefix /devel/new_compiler/engsrc/tools/linux/bin/../lib/gcc/powerpc-wrs-vxworks/3.4.0/ -isystem /devel/new_compiler/engsrc/tools/linux/lib/gcc-lib/include -isystem /devel/new_compiler/engsrc/tools/linux/powerpc-wrs-vxworks/bin/include -DCPU_FAMILY=PPC -D__ppc -D__EABI__ -DCPU=PPC603 -D__hardfp -DVXWORKS -DROM_SIZE=0x00080000 -DRAM_LOW_ADRS=0x00010000 -DRAM_HIGH_ADRS=0x01000000 Test.cpp -mcpu=603 -mstrict-align -mstrict-align -Wall -fno-exceptions -fno-builtin -fno-exceptions -fworking-directory -o Test.ii
ignoring nonexistent directory
"/devel/new_compiler/engsrc/tools/linux/lib/gcc-lib/include"
ignoring nonexistent directory
"/devel/new_compiler/engsrc/tools/linux/powerpc-wrs-vxworks/bin/include"
ignoring nonexistent directory
"/devel/new_compiler/engsrc/tools/Tornado/target/h/c++/3.4.0-O2"
#include "..." search starts here:
#include <...> search starts here:
/devel/new_compiler/engsrc/tools/Tornado/target/config/all
/devel/new_compiler/engsrc/tools/Tornado/target/src/config
/devel/new_compiler/engsrc/tools/Tornado/target/src/drv
/devel/new_compiler/engsrc/tools/Tornado/target/h
End of search list.
/devel/new_compiler/engsrc/tools/linux/bin/../libexec/gcc/powerpc-wrs-vxworks/3.4.0/cc1plus -fpreprocessed Test.ii -mcpu=603 -mstrict-align -quiet -dumpbase Test.cpp -mstrict-align -auxbase Test -g -gdwarf-2 -Wall -version -fno-exceptions -fno-builtin -fno-exceptions -o Test.s
GNU C++ version 3.4.0 20040130 (prerelease) (powerpc-wrs-vxworks)
compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63140
Test.cpp: In function `void test()':
Test.cpp:26: warning: ignoring packed attribute on unpacked non-POD field
`TempStructType test()::<anonymous struct>::tmp3'
/devel/new_compiler/engsrc/tools/linux/powerpc-wrs-vxworks/bin/as -mppc -V -Qy
-mbig -o Test.o Test.s
GNU assembler version 2.13.1 (powerpc-wrs-vxworks) using BFD version 2.13.1
--
Summary: packed attribute does not take effect when using typedef
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bkramer at ciprico dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-wrs-vxworks
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] packed attribute does not take effect when using typedef
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
@ 2004-02-02 16:56 ` bkramer at ciprico dot com
2004-02-02 17:02 ` [Bug c++/13983] no warning on some non-POD struct with packed attribute pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: bkramer at ciprico dot com @ 2004-02-02 16:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkramer at ciprico dot com 2004-02-02 16:56 -------
Created an attachment (id=5651)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5651&action=view)
Preprocessed file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
2004-02-02 16:56 ` [Bug c++/13983] " bkramer at ciprico dot com
@ 2004-02-02 17:02 ` pinskia at gcc dot gnu dot org
2004-03-27 0:08 ` mdorey at bluearc dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-02 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-02 17:02 -------
Actually the warning is correct, the problem is that the warning is not on the other structs for some
reason when it should be as non-POD's ignore the packed attribute.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2004-02-02 17:02:03
date| |
Summary|packed attribute does not |no warning on some non-POD
|take effect when using |struct with packed attribute
|typedef |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
2004-02-02 16:56 ` [Bug c++/13983] " bkramer at ciprico dot com
2004-02-02 17:02 ` [Bug c++/13983] no warning on some non-POD struct with packed attribute pinskia at gcc dot gnu dot org
@ 2004-03-27 0:08 ` mdorey at bluearc dot com
2004-03-29 21:27 ` mdorey at bluearc dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mdorey at bluearc dot com @ 2004-03-27 0:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mdorey at bluearc dot com 2004-03-27 00:08 -------
(In reply to comment #2)
> non-POD's ignore the packed attribute.
We have a packed non-POD which abstracts byte-ordering which we use in lots of
packed structs. Although the language spec doesn't talk about packing, being
able to do this efficiently is one of the key benefits of C++ for us. Is it
really the case that *all* non-PODs ignore the packed attribute? Nathan seemed
to contradict that in gcc/testsuite/g++.dg/ext/packed2.C, where he wrote:
// July 2003
// packing of non-pods is now only allowed if the non-pod is itself
// packed. Also only such pods can be reference bound to non-consts
Which would let us do what we want to do just fine. To the same end, in the
original(?) PR for packed2.C, Jason said:
The problem is that the #pragma pack means that _GEIdx::addr
might not have the usual alignment of an ftn_addr, so we
can't just take the address of current.addr in order to bind
it to a reference. expand_expr knows this, and tries to
make a bitwise copy and take the address of that. But since
ftn_addr has a copy constructor, we can't make bitwise
copies, so we abort.
This is because "ftn_addr" isn't packed but it's being used to define a field in
a packed structure. If they're both packed, then the alignment of "ftn_addr" is
always the same (1) and the need to copy won't arise.
If that's agreed, then can we go back to saying that this is a problem with
typedef? This code compiles OK with 3.4.0 20040324:
template <class T>
struct A {
A();
} __attribute__ ((packed));
//typedef A<int> Ai;
struct B {
A<int> a;
} __attribute__ ((packed));
typedef A<int> Ai;
struct C {
Ai a;
} __attribute__ ((packed));
But uncommenting the first typedef for Ai prevents it from compiling.
Perhaps it's to do with when the typedef is first seen? If it's first seen
after the non-POD has already been used in a packed structure, the typedef seems
to be packed. If before, then unpacked - even though the non-POD it's
typedef()d to is packed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
` (2 preceding siblings ...)
2004-03-27 0:08 ` mdorey at bluearc dot com
@ 2004-03-29 21:27 ` mdorey at bluearc dot com
2004-03-29 22:16 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mdorey at bluearc dot com @ 2004-03-29 21:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mdorey at bluearc dot com 2004-03-29 21:26 -------
At the risk of annoying particularly Andrew Pinski, who does such a sterling job
with triaging all my idiot bugs, I wonder if I can set the severity back to
normal, as I'm claiming - in comment #3 - that this isn't a missing warning but
an incorrect warning, as was originally submitted?
...
Darn, it seems I can't. Perhaps this bug is doomed to languish unread.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
` (3 preceding siblings ...)
2004-03-29 21:27 ` mdorey at bluearc dot com
@ 2004-03-29 22:16 ` pinskia at gcc dot gnu dot org
2005-04-26 19:53 ` mdorey at bluearc dot com
2005-09-18 2:06 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-29 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-29 22:16 -------
Nathan could you comment on this bug.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |nathan at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
` (4 preceding siblings ...)
2004-03-29 22:16 ` pinskia at gcc dot gnu dot org
@ 2005-04-26 19:53 ` mdorey at bluearc dot com
2005-09-18 2:06 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mdorey at bluearc dot com @ 2005-04-26 19:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mdorey at bluearc dot com 2005-04-26 19:53 -------
(In reply to comment #5)
> Nathan could you comment on this bug.
This bug may be related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17519
There's an interesting discussion in that bug, including comments from Nathan.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/13983] no warning on some non-POD struct with packed attribute
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
` (5 preceding siblings ...)
2005-04-26 19:53 ` mdorey at bluearc dot com
@ 2005-09-18 2:06 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-18 2:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-18 02:06 -------
*** Bug 23833 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |Dmitry dot Chepel at acronis
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13983
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-09-18 2:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-02 16:54 [Bug c++/13983] New: packed attribute does not take effect when using typedef bkramer at ciprico dot com
2004-02-02 16:56 ` [Bug c++/13983] " bkramer at ciprico dot com
2004-02-02 17:02 ` [Bug c++/13983] no warning on some non-POD struct with packed attribute pinskia at gcc dot gnu dot org
2004-03-27 0:08 ` mdorey at bluearc dot com
2004-03-29 21:27 ` mdorey at bluearc dot com
2004-03-29 22:16 ` pinskia at gcc dot gnu dot org
2005-04-26 19:53 ` mdorey at bluearc dot com
2005-09-18 2:06 ` pinskia at gcc dot gnu dot org
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).