vsk added a comment.

In https://reviews.llvm.org/D32456#736120, @efriedma wrote:

> > Note: it would still not be able to catch the following case --
>
> Do you know why?


As-written, the alignment check doesn't apply to loads and stores on 
non-pointer POD types. The reason why is probably that most of these 
loads/stores happen on the stack, where the data should be aligned.



================
Comment at: lib/CodeGen/CodeGenModule.cpp:2319
+      // The alignment sanitizer can catch more bugs if we don't attach
+      // alignment info to extern globals.
+    } else {
----------------
efriedma wrote:
> If we don't explicitly set the alignment, is it 1?  Or is it picking up the 
> alignment from the type somehow?
If the alignment isn't explicitly set, it is initialized to 0. The LangRef 
states: 'Either global variable definitions or declarations may have an 
explicit section to be placed in and may have an optional explicit alignment 
specified'. It should be OK to not specify the alignment.


https://reviews.llvm.org/D32456



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to