[Bug c++/20316] attribute((packed)) and call by reference
falk at debian dot org
gcc-bugzilla@gcc.gnu.org
Fri Mar 4 12:52:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list