mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Don't crash on code where the user put __attribute__((constructor)) on
a function with arguments. This fixes rdar://11265785. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bdcfb7663a
commit
3b5b2a22ca
@ -1033,7 +1033,11 @@ bool ObjCARCAPElim::runOnModule(Module &M) {
|
||||
Value *Op = *OI;
|
||||
// llvm.global_ctors is an array of pairs where the second members
|
||||
// are constructor functions.
|
||||
Function *F = cast<Function>(cast<ConstantStruct>(Op)->getOperand(1));
|
||||
Function *F = dyn_cast<Function>(cast<ConstantStruct>(Op)->getOperand(1));
|
||||
// If the user used a constructor function with the wrong signature and
|
||||
// it got bitcasted or whatever, look the other way.
|
||||
if (!F)
|
||||
continue;
|
||||
// Only look at function definitions.
|
||||
if (F->isDeclaration())
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user