rsmith added inline comments.

================
Comment at: lib/CodeGen/CGExpr.cpp:579
@@ -578,1 +578,3 @@
+    // Make sure we're not losing information. Alignment needs to be a power 
of 2
+    assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
     llvm::Constant *StaticData[] = {
----------------
filcab wrote:
> Would it be acceptable to set AlignVal to 1 if it's 0?
Yes, that seems fine. The alignment check will never fire if `AlignVal` is zero 
(that only happens if the type in question is incomplete, and we don't emit a 
check for it in that case). Setting it to 1 should prevent the runtime library 
from thinking that we detected an alignment problem.

It looks like the current patch will emit 255 as the alignment in that case; 
that also seems fine as a way of indicating "no alignment check". I doubt we'll 
ever need to deal with a real alignment value of 2^255 :)


http://reviews.llvm.org/D19667



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

Reply via email to