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



Yuri Gribov <tetra2005 at gmail dot com> changed:



           What    |Removed                     |Added

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

                 CC|                            |tetra2005 at gmail dot com



--- Comment #4 from Yuri Gribov <tetra2005 at gmail dot com> 2012-10-18 
11:41:10 UTC ---

Gcc does warn (actually it even errs) if you try to pass unaligned variable by

reference but does not do this when you use pointers:

  $ g++ -Wall -c pack_warns.cpp

  pack_warns.cpp:22:9: error: cannot bind packed field 't->Test::x' to 'float&'



Also it'll fail to warn if you use #pragma pack instead of

__attribute__((packed)):

  $ g++ -Wall -c -DUSE_PRAGMA pack_warns.cpp   # Compiles wo warnings



Just wanted to mention that users frequently run into errors with unaligned

data (especially on targets where it really matters e.g. on ARM) so this might

be important issue.

Reply via email to