Use iterator instead of address of element in vector
It is not valid to access one after the last element.
rdar://
28759508
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284150
91177308-0d34-0410-b5e6-
96231b3b80d8
auto eltTy = split.first;
CharUnits eltSize = getTypeStoreSize(CGM, eltTy);
auto numElts = split.second;
- Entries.insert(&Entries[index + 1], numElts - 1, StorageEntry());
+ Entries.insert(Entries.begin() + index + 1, numElts - 1, StorageEntry());
CharUnits begin = Entries[index].Begin;
for (unsigned i = 0; i != numElts; ++i) {
TEST(struct_l5)
// CHECK: define swiftcc void @return_struct_l5([[STRUCT5:%.*]]* noalias sret
// CHECK: define swiftcc void @take_struct_l5([[STRUCT5]]*
+
+
+// Don't crash.
+typedef union {
+int4 v[2];
+struct {
+ int LSW;
+ int d7;
+ int d6;
+ int d5;
+ int d4;
+ int d3;
+ int d2;
+ int MSW;
+} s;
+} union_het_vecint;
+TEST(union_het_vecint)
+// CHECK: define swiftcc void @return_union_het_vecint([[UNION:%.*]]* noalias sret
+// CHECK: define swiftcc void @take_union_het_vecint([[UNION]]*