Author: chandlerc
Date: Sun Oct 19 14:41:46 2014
New Revision: 220169
URL: http://llvm.org/viewvc/llvm-project?rev=220169&view=rev
Log:
Revert r220153: "CodeGen: ConstStructBuilder must verify packed constraints
after padding"
This commit caused two tests in LNT to regress. I'm able to reproduce on
any platform and will send reproduction steps to the original commit
log. This should restore the LNT bots that have been failing.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGen/const-init.c
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sun Oct 19 14:41:46 2014
@@ -106,6 +106,15 @@ AppendBytes(CharUnits FieldOffsetInChars
CharUnits AlignedNextFieldOffsetInChars =
NextFieldOffsetInChars.RoundUpToAlignment(FieldAlignment);
+ if (AlignedNextFieldOffsetInChars > FieldOffsetInChars) {
+ assert(!Packed && "Alignment is wrong even with a packed struct!");
+
+ // Convert the struct to a packed struct.
+ ConvertStructToPacked();
+
+ AlignedNextFieldOffsetInChars = NextFieldOffsetInChars;
+ }
+
if (AlignedNextFieldOffsetInChars < FieldOffsetInChars) {
// We need to append padding.
AppendPadding(FieldOffsetInChars - NextFieldOffsetInChars);
@@ -113,16 +122,6 @@ AppendBytes(CharUnits FieldOffsetInChars
assert(NextFieldOffsetInChars == FieldOffsetInChars &&
"Did not add enough padding!");
- AlignedNextFieldOffsetInChars =
- NextFieldOffsetInChars.RoundUpToAlignment(FieldAlignment);
- }
-
- if (AlignedNextFieldOffsetInChars > FieldOffsetInChars) {
- assert(!Packed && "Alignment is wrong even with a packed struct!");
-
- // Convert the struct to a packed struct.
- ConvertStructToPacked();
-
AlignedNextFieldOffsetInChars = NextFieldOffsetInChars;
}
Modified: cfe/trunk/test/CodeGen/const-init.c
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/const-init.c?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/const-init.c (original)
+++ cfe/trunk/test/CodeGen/const-init.c Sun Oct 19 14:41:46 2014
@@ -159,14 +159,3 @@ void g29() {
static int b[1] = { "asdf" }; // expected-warning {{incompatible pointer to
integer conversion initializing 'int' with an expression of type 'char [5]'}}
static int c[1] = { L"a" };
}
-
-// PR21300
-void g30() {
-#pragma pack(1)
- static struct {
- int : 1;
- int x;
- } a = {};
- // CHECK: @g30.a = internal global %struct.anon.1 <{ i8 undef, i32 0 }>,
align 1
-#pragma pack()
-}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits