Skip to content

Commit a5ae8a5

Browse files
[swiftc (21 vs. 5389)] Add crasher in swift::NewMangling::Mangler::appendIdentifier(...)
Add test case for crash triggered in `swift::NewMangling::Mangler::appendIdentifier(...)`. Current number of unresolved compiler crashers: 21 (5389 resolved) /cc @eeckstein - just wanted to let you know that this crasher caused an assertion failure for the assertion `!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"` added on 2016-12-02 by you in commit 684092d :-) Assertion failure in [`include/swift/Basic/ManglingUtils.h (line 187)`](https://github.com/apple/swift/blob/master/include/swift/Basic/ManglingUtils.h#L187): ``` Assertion `!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"' failed. When executing: void swift::NewMangling::mangleIdentifier(Mangler &, llvm::StringRef) [Mangler = swift::NewMangling::Mangler] ``` Assertion context: ``` // Mangle the sub-string up to the next word substitution (or to the end // of the identifier - that's why we added the dummy-word). // The first thing: we add the encoded sub-string length. M.Buffer << (Repl.StringPos - Pos); assert(!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"); do { // Update the start position of new added words, so that they refer to // the begin of the whole mangled Buffer. if (WordsInBuffer < M.Words.size() && M.Words[WordsInBuffer].start == Pos) { ``` Stack trace: ``` 0 0x0000000003512118 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3512118) 1 0x0000000003512856 SignalHandler(int) (/path/to/swift/bin/swift+0x3512856) 2 0x00007f97fd01b3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0) 3 0x00007f97fb749428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0 4 0x00007f97fb74b02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0 5 0x00007f97fb741bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0 6 0x00007f97fb741c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82) 7 0x0000000000efb1ec void swift::NewMangling::mangleIdentifier<swift::NewMangling::Mangler>(swift::NewMangling::Mangler&, llvm::StringRef) (/path/to/swift/bin/swift+0xefb1ec) 8 0x0000000000efa72d swift::NewMangling::Mangler::appendIdentifier(llvm::StringRef) (/path/to/swift/bin/swift+0xefa72d) 9 0x0000000000dcef51 swift::NewMangling::ASTMangler::appendDeclName(swift::ValueDecl const*) (/path/to/swift/bin/swift+0xdcef51) 10 0x0000000000dcbbc6 swift::NewMangling::ASTMangler::appendEntity(swift::ValueDecl const*, llvm::StringRef, bool) (/path/to/swift/bin/swift+0xdcbbc6) 11 0x0000000000dccb0e swift::NewMangling::ASTMangler::mangleGlobalVariableFull[abi:cxx11](swift::VarDecl const*) (/path/to/swift/bin/swift+0xdccb0e) 12 0x00000000006694b5 swift::Lowering::SILGenModule::getSILGlobalVariable(swift::VarDecl*, swift::ForDefinition_t) (/path/to/swift/bin/swift+0x6694b5) 13 0x000000000063a3e5 swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*) (/path/to/swift/bin/swift+0x63a3e5) 14 0x000000000063c0a1 swift::ASTVisitor<(anonymous namespace)::InitializationForPattern, void, void, void, std::unique_ptr<swift::Lowering::Initialization, std::default_delete<swift::Lowering::Initialization> >, void, void>::visit(swift::Pattern*) (/path/to/swift/bin/swift+0x63c0a1) 15 0x000000000063b164 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) (/path/to/swift/bin/swift+0x63b164) 16 0x000000000063b2dd swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) (/path/to/swift/bin/swift+0x63b2dd) 17 0x000000000061e0ac swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x61e0ac) 18 0x000000000061e96b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) (/path/to/swift/bin/swift+0x61e96b) 19 0x000000000061f95b swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) (/path/to/swift/bin/swift+0x61f95b) 20 0x000000000061ffb5 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) (/path/to/swift/bin/swift+0x61ffb5) 21 0x000000000047e7a5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x47e7a5) 22 0x000000000043ade7 main (/path/to/swift/bin/swift+0x43ade7) 23 0x00007f97fb734830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0 24 0x0000000000438229 _start (/path/to/swift/bin/swift+0x438229) ```
1 parent 1aeca5b commit a5ae8a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// RUN: not --crash %target-swift-frontend %s -emit-ir
9+
// REQUIRES: asserts
10+
// non-fuzz
11+
let β1=0

0 commit comments

Comments
 (0)