Skip to content

[SR-2230] clang-built swift compiler breaks since clang revision 274385 #44837

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
swift-ci opened this issue Jul 31, 2016 · 3 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-2230
Radar https://llvm.org/bugs/show_bug.cgi?id=28695
Original Reporter shaharv (JIRA User)
Type Bug

Attachment: Download

Environment

Ubuntu 16.04, Clang 4.0 (trunk)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 49328686a4a24a9624f2fe30c30ebae6

Issue Description:

clang-built swift compiler breaks since clang revision 274385.
This might be related to clang issue #28603 (https://llvm.org/bugs/show_bug.cgi?id=28603).

When building swift using clang r274385, the built swift compiler asserts, and fails to build the swift runtime. With clang r274379 (revisions 274380-4 seem unrelated), swift is built successfully. clang r274385 revealed some cases of user code breaking due to dangling references, which might be related. See also comments to clang bug #28695 (https://llvm.org/bugs/show_bug.cgi?id=28695).

This issue reproduced with swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-1538-ge657ece, but also with a much older version (from Aug/15).

For reproduction, please refer to the attached script, clang_swift_good_and_bad.sh, which fetches swift and clang, builds clang r274379 ("good"), builds swift (successful), fetches and builds clang r274385 ("bad"), and builds swift (asserts). Also please see log_ubuntu_16_04_25Jul16.txt for reference output.

@swift-ci
Copy link
Contributor Author

Comment by Shahar Valiano (JIRA)

The full assert message:

#0 0x00000000032e78f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x32e78f5)
#1 0x00000000032e5eb6 llvm::sys::RunSignalHandlers() (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x32e5eb6)
#2 0x00000000032e7faa SignalHandler(int) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x32e7faa)
#3 0x00007f5e85f463d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113d0)
#4 0x000000000111b1f0 swift::TypeBase::getDesugaredType() (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x111b1f0)
#5 0x0000000000f6363c (anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr*, swift::Type, swift::constraints::ConstraintLocatorBuilder) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf6363c)
#6 0x0000000000f62c13 (anonymous namespace)::ExprRewriter::buildMemberRef(swift::Expr*, swift::Type, swift::SourceLoc, swift::ValueDecl*, swift::DeclNameLoc, swift::Type, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder, bool, swift::AccessSemantics, bool) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf62c13)
#7 0x0000000000f71b11 (anonymous namespace)::ExprRewriter::buildDeclRef(swift::ValueDecl*, swift::DeclNameLoc, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool, bool, swift::AccessSemantics) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf71b11)
#8 0x0000000000f6c2b2 swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf6c2b2)
#9 0x0000000000f609b0 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf609b0)
#10 0x0000000000f64b00 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf64b00)
#11 0x000000000106eb9c (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x106eb9c)
#12 0x000000000106db0f swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x106db0f)
#13 0x000000000106bd0b swift::Expr::walk(swift::ASTWalker&) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x106bd0b)
#14 0x0000000000f5d4bf swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf5d4bf)
#15 0x0000000000ebc6b3 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xebc6b3)
#16 0x0000000000f34cd2 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf34cd2)
#17 0x0000000000f33c21 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf33c21)
#18 0x0000000000f32ec5 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf32ec5)
#19 0x0000000000f3216a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf3216a)
#20 0x0000000000f31fc9 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf31fc9)
#21 0x0000000000f32b50 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xf32b50)
#22 0x0000000000eef7b7 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xeef7b7)
#23 0x0000000000ef02f1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xef02f1)
#24 0x0000000000c85e0b swift::CompilerInstance::performSema() (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0xc85e0b)
#25 0x00000000007e33c4 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x7e33c4)
#26 0x00000000007e22dc swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x7e22dc)
#27 0x00000000007abb0f main (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x7abb0f)
#28 0x00007f5e8465f830 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#29 0x00000000007a9019 _start (/home/shahar/_work/llvm-swift-bug/swift/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift+0x7a9019)

@belkadan
Copy link
Contributor

belkadan commented Aug 1, 2016

It sounds like this is really just a Clang issue, and that there's nothing the Swift project needs to do here. @bob-wilson, what do you think?

@bob-wilson
Copy link
Contributor

I don't have any specific information to add but it sounds like the other issues were latent bugs exposed by a clang change. I don't see anything to indicate otherwise in this case.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants