Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[SR-12635] Segmentation fault when building with coverage enabled #55079

Closed
swift-ci opened this issue Apr 21, 2020 · 2 comments
Closed

[SR-12635] Segmentation fault when building with coverage enabled #55079

swift-ci opened this issue Apr 21, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code coverage Area → source tooling: code coverage compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12635
Radar rdar://problem/62894523
Original Reporter BalestraPatrick (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 11.4, Swift 5.2

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

md5: debde29acf197350a05b37532ae5800d

Issue Description:

I found a segmentation fault when migrating our codebase to Swift 5.2 and Xcode 11.4. I managed to reproduce it in a very simple case:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { }

class EffectHandler {
    init(dispatchDelay: DispatchTimeInterval = .seconds(UIAccessibility.isVoiceOverRunning ? 4 : 2)) { }
}

Compiling the attached Xcode project with code coverage enabled using

xcodebuild build-for-testing -project Segfault.xcodeproj -scheme Segfault -destination generic/platform\=iOS\ Simulator -configuration Debug -enableCodeCoverage YES

triggers the following segmentation fault:

1. Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)1. Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)2. While silgen constructor initializer SIL function "@$s8Segfault13EffectHandlerC13dispatchDelayAC8Dispatch0F12TimeIntervalO_tcfc". for 'init(dispatchDelay:)' (at /Users/patrickb/Desktop/Segfault/Segfault/AppDelegate.swift:7:5)0  swift                    0x000000010584e4ea PrintStackTraceSignalHandler(void*) + 421  swift                    0x000000010584dcc0 SignalHandler(int) + 3522  libsystem_platform.dylib 0x00007fff7164b42d _sigtramp + 293  libsystem_platform.dylib 0x00007fcb622e3828 _sigtramp + 40397383924  swift                    0x0000000102578510 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 1925  swift                    0x000000010257c1e3 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 2116  swift                    0x000000010257af87 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::ParameterList*) + 3277  swift                    0x000000010257e0e7 (anonymous namespace)::Traversal::visitAbstractFunctionDecl(swift::AbstractFunctionDecl*) + 4878  swift                    0x000000010257ae03 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 2759  swift                    0x0000000101f72538 swift::SILProfiler::create(swift::SILModule&, swift::ForDefinition_t, swift::ASTNode, swift::SILDeclRef) + 282410 swift                    0x00000001019b619a swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*) + 354611 swift                    0x0000000101aaf3b1 swift::ASTVisitor<(anonymous namespace)::SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 14512 swift                    0x0000000101aad45b (anonymous namespace)::SILGenType::emitType() + 93913 swift                    0x00000001019bf5e2 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 8214 swift                    0x00000001019be7ac swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 135615 swift                    0x00000001019c082e swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 143816 swift                    0x00000001015a0657 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4805517 swift                    0x00000001015184d3 main + 128318 libdyld.dylib            0x00007fff714527fd start + 1error: Segmentation fault: 11 (in target 'Segfault' from project 'Segfault')

Building without code coverage enabled fixes the issue:

xcodebuild build-for-testing -project Segfault.xcodeproj -scheme Segfault -destination generic/platform\=iOS\ Simulator -configuration Debug
@beccadax
Copy link
Contributor

beccadax commented May 5, 2020

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@hamishknight hamishknight added the code coverage Area → source tooling: code coverage label Sep 20, 2022
@hamishknight
Copy link
Collaborator

This was fixed by #30039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code coverage Area → source tooling: code coverage compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants