================
Comment at: test/Sema/offsetof.c:74
@@ +73,3 @@
+// PR15216
+// Don't crash on when taking computing the offset of structs with large 
arrays.
+const unsigned long Size = (1l << 62);
----------------
Comment slightly mangled?

================
Comment at: lib/AST/ASTContext.cpp:1358
@@ +1357,3 @@
+  unsigned Align = EltInfo.second / CharWidth;
+  Width = llvm::RoundUpToAlignment(Width, Align);
+  return std::make_pair(CharUnits::fromQuantity(Width),
----------------
This shouldn't be necessary; EltInfo.first / CharWidth should have been a 
multiple of EltInfo.second / CharWidth. Maybe convert this to an assertion?

================
Comment at: test/Sema/offsetof.c:77-80
@@ +76,6 @@
+
+struct Chunk {
+  char padding[Size];
+  char data;
+};
+
----------------
Does sizeof(Chunk) work here? Or 'char padding[1][Size];'? I suspect we'll need 
a more comprehensive solution to this problem -- perhaps reformulating the 
whole computation in terms of CharUnits.


http://llvm-reviews.chandlerc.com/D781
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to