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-11747] fatal error when compiling big tuples #54154

Closed
swift-ci opened this issue Nov 9, 2019 · 2 comments
Closed

[SR-11747] fatal error when compiling big tuples #54154

swift-ci opened this issue Nov 9, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 9, 2019

Previous ID SR-11747
Radar None
Original Reporter cukier (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)
Target: x86_64-apple-darwin19.0.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Crash, DiagnosticsQoI
Assignee cukier (JIRA)
Priority Medium

md5: 486418ad65bea1ece7b1fd6d75c935d1

Issue Description:

https://forums.swift.org/t/t-uple-max-size/30635

When I try to compile a tuple with `2**20 + 1` elements, it crashes the compiler with "Type variable id overflow"

To reproduce I use the following python3 program (number of elements is one bigger than the `size` variable):

size = 2**20
print("let x: Int = 0")
print("let bigTuple: (", end = '')
for i in range(size):
    print("Int,", end = '')
print("Int) = (", end = '')
for i in range(size):
    print("x,", end = '')
print("x)")

The full(ish) error message:

<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Type variable id overflow
Stack dump:
0.  Program arguments: /Users/myUsername/Desktop/Xcode/Xcode 11.2.1 GM.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file main.swift -target x86_64-apple-darwin19.0.0 -enable-objc-interop -sdk /Users/myUsername/Desktop/Xcode/Xcode 11.2.1 GM.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -module-name main -o /var/folders/9r/3t0y3zlj2l34w2t5vsgxz_7w0000gn/T/main-86f56f.o
1.  While type-checking statement at [main.swift:2:1 - line:2:6291481] RangeText="let bigTuple: <snip>
2.  While type-checking declaration 0x121596fb0 (at main.swift:2:1)
3.  While type-checking expression at [main.swift:2:4194327 - line:2:6291481] RangeText="(x,x,x,x,x <snip>
0  swift                    0x0000000114076a13 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x00000001140761e6 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff71d4cb1d _sigtramp + 29
3  libsystem_platform.dylib 0x000000011f3aa4a7 _sigtramp + 2909133223
4  libsystem_c.dylib        0x00007fff71c22a08 abort + 120
5  swift                    0x000000010fcb99e0 std::__1::unique_ptr<swift::DiagnosticConsumer, std::__1::default_delete<swift::DiagnosticConsumer> > llvm::function_ref<std::__1::unique_ptr<swift::DiagnosticConsumer, std::__1::default_delete<swift::DiagnosticConsumer> > (swift::InputFile const&)>::callback_fn<createSerializedDiagnosticConsumerIfNeeded(swift::FrontendInputsAndOutputs const&)::$_15>(long, swift::InputFile const&) + 0
6  swift                    0x0000000113fef836 llvm::report_fatal_error(llvm::Twine const&, bool) + 278
7  swift                    0x0000000113fef71b llvm::report_fatal_error(char const*, bool) + 43
8  swift                    0x00000001106f5c5c swift::constraints::ConstraintSystem::createTypeVariable(swift::constraints::ConstraintLocator*, unsigned int) + 236
9  swift                    0x00000001106b9034 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) + 15268
10 swift                    0x00000001106b44c0 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 464
11 swift                    0x0000000110b7e307 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 2871
12 swift                    0x00000001106ae921 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*, swift::DeclContext*) + 849
13 swift                    0x00000001106ffccb swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 8267
14 swift                    0x0000000110803af1 swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 1041
15 swift                    0x0000000110805cf2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 898
16 swift                    0x0000000110806a71 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 225
17 swift                    0x0000000110813a6a (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 7802
18 swift                    0x00000001108b3b9e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 23854
19 swift                    0x00000001108ade11 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 129
20 swift                    0x00000001108b6b97 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 263
21 swift                    0x00000001108d22b8 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1656
22 swift                    0x000000010ffc4687 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 4679
23 swift                    0x000000010fcba216 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 806
24 swift                    0x000000010fcb66e4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
25 swift                    0x000000010fc43be3 main + 1219
26 libdyld.dylib            0x00007fff71b4b405 start + 1
27 libdyld.dylib            0x000000000000000e start + 2387299338
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
@beccadax
Copy link
Contributor

@xedin @hborla

@xedin
Copy link
Member

xedin commented Nov 11, 2019

Yes, this indeed used to be a problem which has been fixed on master by @davezarzycki's PR #25818 Please verify using one of the nightly master compiler snapshots.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added type checker Area → compiler: Semantic analysis CompilerCrash labels Sep 17, 2022
This issue was closed.
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants