From 87008f24ad3b9eab2e1d321c79338413f2b74241 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sun, 20 Dec 2015 22:08:36 +0100 Subject: [PATCH] [SIL] Add test case for crash triggered in swift::Parser::parseSILGlobal() Stack trace: ``` :3:36: error: expected ']' or ',' in attribute list sil_global@_a:$()sil_global[fragile@_a:$( ^ :3:42: error: expected type sil_global@_a:$()sil_global[fragile@_a:$( ^ :3:42: error: expected ',' separator sil_global@_a:$()sil_global[fragile@_a:$( ^ , sil-opt: /path/to/swift/lib/SIL/SILGlobalVariable.cpp:29: static swift::SILGlobalVariable *swift::SILGlobalVariable::create(swift::SILModule &, swift::SILLinkage, bool, llvm::StringRef, swift::SILType, Optional, swift::VarDecl *): Assertion `!entry->getValue() && "global variable already exists"' failed. 9 sil-opt 0x0000000000a25f6c swift::Parser::parseSILGlobal() + 684 10 sil-opt 0x00000000009f5c3b swift::Parser::parseTopLevel() + 731 11 sil-opt 0x00000000009f0f7f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207 12 sil-opt 0x00000000007392a6 swift::CompilerInstance::performSema() + 2918 13 sil-opt 0x0000000000723efc main + 1916 Stack dump: 0. Program arguments: sil-opt -enable-sil-verify-all 1. With parser at source location: :3:42 ``` --- .../SIL/crashers/013-swift-parser-parsesilglobal.sil | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 validation-test/SIL/crashers/013-swift-parser-parsesilglobal.sil diff --git a/validation-test/SIL/crashers/013-swift-parser-parsesilglobal.sil b/validation-test/SIL/crashers/013-swift-parser-parsesilglobal.sil new file mode 100644 index 0000000000000..f0e4492e4194b --- /dev/null +++ b/validation-test/SIL/crashers/013-swift-parser-parsesilglobal.sil @@ -0,0 +1,3 @@ +// RUN: not --crash %target-sil-opt %s +// REQUIRES: asserts +sil_global@_a:$()sil_global[fragile@_a:$( \ No newline at end of file