mirror of
https://github.com/intel/llvm.git
synced 2026-02-02 10:08:59 +08:00
[CodeGen] Correctly handle base classes which are passed in memory
We didn't correctly process the case where a base class is classified as MEMORY. This would cause us to trip over an assertion. This fixes PR24020. Differential Revision: http://reviews.llvm.org/D10907 llvm-svn: 241667
This commit is contained in:
@@ -2073,8 +2073,10 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
|
||||
classify(I.getType(), Offset, FieldLo, FieldHi, isNamedArg);
|
||||
Lo = merge(Lo, FieldLo);
|
||||
Hi = merge(Hi, FieldHi);
|
||||
if (Lo == Memory || Hi == Memory)
|
||||
break;
|
||||
if (Lo == Memory || Hi == Memory) {
|
||||
postMerge(Size, Lo, Hi);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -196,3 +196,19 @@ namespace test9 {
|
||||
return sret;
|
||||
}
|
||||
}
|
||||
|
||||
namespace test10 {
|
||||
#pragma pack(1)
|
||||
struct BasePacked {
|
||||
char one;
|
||||
short two;
|
||||
};
|
||||
#pragma pack()
|
||||
struct DerivedPacked : public BasePacked {
|
||||
int three;
|
||||
};
|
||||
// CHECK-LABEL: define i32 @_ZN6test1020FuncForDerivedPackedENS_13DerivedPackedE({{.*}}* byval align 8
|
||||
int FuncForDerivedPacked(DerivedPacked d) {
|
||||
return d.three;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user