This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20316] attribute((packed)) and call by reference
- From: "falk at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Mar 2005 12:52:01 -0000
- Subject: [Bug c++/20316] attribute((packed)) and call by reference
- References: <20050304122321.20316.nkoch@demig.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From falk at debian dot org 2005-03-04 12:51 -------
(In reply to comment #0)
> Probably, this is not a bug but a feature
Indeed, it is.
> but what can I do
> to my program, which needs a lot of packed structures and runs fine
> with gcc3.3?
Nothing. It only "worked" by accident in 3.3, and will crash on many architectures.
> I understand, that my code may not work on cpus needing some specific
> alignment, but where is the problem with char?
It would be completely useless to make an exception for char here.
> And if this is a cpu issue,
> why do the pointers work, but _not_ the references?
Having pointers point to things that are not correctly aligned for their
type does *not* work. It might be easier to fool the compiler to not reject
it, though, and it might accidentally do what you meant it to do on some
architectures.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20316