Skip to content

[ThinLTO] Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) && "invalid type for global variable"' failed. #34595

@rgal

Description

@rgal
Bugzilla Link 35247
Resolution FIXED
Resolved on Nov 14, 2017 11:48
Version 5.0
OS Linux
Blocks #33840
CC @pogo59,@pcc,@tstellar,@wjristow
Fixed by commit(s) r310543 r318181

Extended Description

Tested at r316607 on release_50.

==> a.cpp <==
int* A();

int main() {
int* s(A());
}

==> b.cpp <==
struct SF {
SF();
};

SF::SF() {}

SF* A() {
new SF();
}
$ clang -o a.o -flto=thin -c a.cpp
$ clang -o b.o -flto=thin -c b.cpp
$ llvm-lto a.o b.o --thinlto-action=run
llvm-lto: .../llvm/lib/IR/Globals.cpp:317: llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, const llvm::Twine&, llvm::GlobalVariable*, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool): Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) && "invalid type for global variable"' failed.

Not seen on master (r317500).

Note that there are multiple versions of A() in this example. With this fixed, there is no assertion failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions