With our newfound clang options, I'm seeing alignment errors in this block of 
code:

https://github.com/open-mpi/ompi-svn-mirror/blob/master/opal/mca/base/mca_base_var.c#L662-L673

Specifically, it's warning on lines 664 (type INT) and 672 (type BOOL).  The 
complaint is:

-----
mca_base_var.c:664:13: runtime error: member access within misaligned address 
0x2aaaab1b1ed9 for type 'mca_base_var_storage_t', which requires 8 byte 
alignment
-----

I *think* this is a false warning.  I *think* it is saying that dst, which is 
of type (mca_base_var_storage_t *), which is a union of all the possible 
storage types, requires an alignment of 8.  But it's *not* actually a 
(mca_base_var_storage_t); it's actually an int or a bool, and therefore its 
alignment can be less than 8.

I verified that the alignment of &dst->intval and &dst->boolval is always 
aligned properly (i.e., for every MCA var that comes through this block).  And 
clang is specifically citing that the access on line 664 and 672 require an 
alignment of 8.

Is this analysis correct?

Regardless, what do we do about this?

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to