/swift-compiler-crashes

A collection of test cases crashing the Swift compiler.

Primary LanguageSwiftMIT LicenseMIT

Project swift-compiler-crashes

This repo collects known test cases crashing the Swift compiler. All tests cases in the crashes/, crashes-memory-corruption/ and crashes-fuzzing/ directories are known to generate a compiler crash under the current Swift compiler compiled from the master branch (if not, please report!).

Help us towards a rock solid Swift compiler by contributing any compiler crashes you may encounter.

Happy Swifting! :-)

Contributor hall of fame

GitHub Twitter Cases contributed First contribution
@practicalswift – practicalswift @practicalswift 67 cases (+ 27982 fuzzing) Xcode6.0-Beta6
@robrix – Rob Rix @robrix 23 cases Xcode6.0-Beta6
@airspeedswift – Airspeed Velocity @airspeedswift 18 cases Xcode6.1.1-GM-Seed
@beltex – beltex 10 cases Xcode6.1.1-GM-Seed
@fluidsonic – Marc Knaup @marcknaup 7 cases Xcode6.1-Beta3
@zneak – Félix Cloutier @zneakr 9 cases Xcode6.1.1-GM-Seed
@CodaFi – Robert Widmann @CodaFi_ 5 cases Xcode6.4-Beta3
@rnapier – Rob Napier @cocoaphony 4 cases Xcode6.0-Beta7
@rustedivan – Ivan Milles @rustedivan 4 cases Xcode6.1.1-GM-Seed
@tmu – Teemu Kurppa @Teemu 4 cases Xcode6.0-Beta6
@jtbandes – Jacob Bandes-Storch @jtbandes 3 cases Xcode7.0-Beta5
@jvasileff – John Vasileff @jvasileff 2 cases Xcode6.0-Beta6
@owensd – David Owens II @owensd 2 cases Xcode6.0-Beta6
@radex – Radek Pietruszewski @radexp 2 cases Xcode6.1
@0xc010d – Ievgen Solodovnykov @0xc010d 1 case Xcode6.0-Beta6
@adfernandes – Andrew Fernandes 1 case Xcode6.3-Beta2
@AlexDenisov – Alexey Denisov @1101_debian 1 case Xcode6.0-Beta6
@ArtisOracle – Stefan Arambasich @ArtisOracle 1 case Xcode6.1.1-GM-Seed
@champo – Juan Pablo Civile @elchampo 1 case Xcode6.3-Beta2
@hendriks73 – Hendrik Schreiber @h_schreiber 1 case Xcode6.2-Beta4
@invalidname – Chris Adamson @invalidname 1 case Xcode6.2-Beta4
@jansabbe – Jan Sabbe @jansabbe 1 case Xcode6.0-Beta6
@juangamnik – juangamnik 1 case Xcode6.1.1-GM-Seed
@julasamer – julasamer 1 case Xcode6.1-Beta1
@martijnwalraven – Martijn Walrav @martijnwalraven 1 case Xcode6.1-GM-Seed2
@mattdaw – Matt Daw @mattdaw 1 case Xcode6.1.1-GM-Seed
@mayoff – Rob Mayoff @rmayoff 1 case Xcode6.1
@valfer – Valerio Ferrucci @valferweet 1 case Xcode6.1-GM-Seed2

Getting started

$ git clone https://github.com/practicalswift/swift-compiler-crashes.git
$ cd swift-compiler-crashes/
$ ./test.sh

Running tests against: Swift version 3.0-dev (LLVM 524cfeb800, Clang f66c5bb67b, Swift 9b97166f31)
Usage: ./test.sh [-v] [-q] [-c<columns>] [-l] [file ...]
Adding a new test case? The crash id to use for the next test case is 28247.

== Currently known crashes, set #1 (verified memory corruption crashes) ==

  ✘  16694 swift constraints constraintsystem opentype            (b962c9536f)
  ✘  23639 llvm jit runfunction                                   (5d90b727d1)
  ✘  24394 swift typevariabletype implementation getrepresentativ (c1c7968f52)
  ✘  28155 swift typechecker validategenericfuncsignature         (26e86b5c8d)
  ✘  28201 swift typechecker resolvetypewitness                   (a1823dee8a)
  ✘  28210 swift declcontext getprotocolself                      (36f796f85c)
  ✘  28223 swift type transform                                   (6ff8d84257)
  ✘  28225 swift typechecker checkconformance                     (c879bf3640)

== Currently known crashes, set #2 (non memory corruption: human reported crashes, crashes not found by fuzzing) ==

  ✘  00041 szone malloc should clear                              (db98596e8a)
  ✘  00046 any array containing ints (repl)                       (          )
  ✘  00061 visit any struct type                                  (          )
  ✘  22725 swift constraints constraintsystem solvesimplified     (549ac16d42)
  ✘  23908 slow type inference (timeout)                          (          )
  ✘  24245 swift constraints constraintsystem solve               (1f9ea2ecd5)
  ✘  24798 no stacktrace                                          (          )
  ✘  24881 swift typebase getcanonicaltype                        (          )
  ✘  24887 no stack trace                                         (          )
  ✘  25962 swift archetypebuilder getallarchetypes                (7db37acc5b)
  ✘  26303 llvm llvm unreachable internal                         (509989f7cb)
  ✘  26725 llvm smallvectorimpl swift diagnosticargument operator (23330bc224)
  ✘  26813 generic enum tuple optional payload                    (ead23d0ff3)
  ✘  27818 swift astvisitor                                       (15f9f1200d)
  ✘  28180 rawrepresentable extension with initializer            (          )
  ✘  28181 llvm irbuilder                                         (e70a22df4d)

== Currently known crashes, set #3 (non memory corruption: crashes found by fuzzing) ==

  ✘  01793 swift nominaltypedecl getdeclaredtypeincontext         (f0521500b7)
  ✘  08008 swift typechecker typecheckexpression                  (          )
  ✘  10659 swift printingdiagnosticconsumer handlediagnostic      (3d5ffe4b26)
  ✘  21765 vtable                                                 (          )
  ✘  26832 swift typechecker conformstoprotocol                   (6770ec1e09)
  ✘  27131 isvalidoverload                                        (56d1368d31)
  ✘  27156 swift typechecker applygenericarguments                (208eeda008)
  ✘  27636 swift typechecker resolvetypeincontext                 (          )
  ✘  27832 swift typechecker resolvetypeincontext                 (          )
  ✘  27939 vtable                                                 (          )
  ✘  28188 swift removeoverriddendecls                            (bdaabfce6a)
  ✘  28193 swift typechecker lookupmembertype                     (b4c491cc54)
  ✘  28195 swift constraints constraintsystem resolveoverload     (35d036c8cd)
  ✘  28198 swift typerepr walk                                    (7b1c0faed6)
  ✘  28199 swift constraints constraintsystem performmemberlookup (556aeb937d)
  ✘  28202 swift typechecker applygenericarguments                (03e173b921)
  ✘  28205 swift protocoldecl requiresclassslow                   (7dffd23b53)
  ✘  28212 swift typechecker resolvetypeincontext                 (1c919bf2b7)
  ✘  28215 swift normalprotocolconformance getwitness             (715678c246)
  ✘  28218 swift valuedecl settype                                (b7e7e3874a)
  ✘  28220 swift lvaluetype get                                   (e10d5d92b0)
  ✘  28221 swift typebase getmembersubstitutions                  (d9804814ba)
  ✘  28222 swift typechecker checkconformance                     (f6a5d48d1e)
  ✘  28224 swift genericfunctiontype get                          (0f77cb8909)
  ✘  28226 swift iterativetypechecker processinheritedprotocols   (93dca93e48)
  ✘  28227 swift typechecker gettypeofrvalue                      (d6f0d1174b)
  ✘  28229 swift valuedecl getinterfacetype                       (1f67450b39)
  ✘  28231 swift constraints constraintsystem solvesimplified     (e514e92eb2)
  ✘  28232 swift typechecker typecheckfunctionbodyuntil           (b57dda809f)
  ✘  28233 swift typebase getmembersubstitutions                  (d1b9c8802a)
  ✘  28234 swift archetypebuilder getgenericsignature             (e16bd7f4a8)
  ✘  28235 swift archetypebuilder addsametyperequirementtoconcret (75d33661a9)
  ✘  28236 swift typebase getmembersubstitutions                  (76791fad8c)
  ✘  28237 swift archetypebuilder addgenericparameter             (813b53d9cb)
  ✘  28238 swift typechecker validatedecl                         (e4a78bd61c)
  ✘  28240 swift archetypebuilder addrequirement                  (ab65e13924)
  ✘  28242 swift constraints constraintsystem simplify            (a1170065fa)
  ✘  28243 swift typebase getcanonicaltype                        (dcc378ba48)
  ✘  28245 swift dependentgenerictyperesolver resolveselfassociat (d74412f0b4)
  ✘  28246 swift expr propagatelvalueaccesskind                   (d114dc1418)

== Crashes marked as fixed in previous releases ==

  ✓  00001 swift typeloc iserror
  ✓  00002 no stacktrace
  ✓  00003 profilearchetypeconstraints
  ✓  00004 no stacktrace
  ✓  00005 no stacktrace
  ✓  00006 swift mangle mangler manglecontext
  ✓  00007 convenience init in extension
  ✓  00008 llvm foldingset llvm attributesetnode nodeequals
  ✓  00009 class referencing protocol referencing class
  ✓  00010 circular protocol reference
  ✓  00011 swift nominaltypedecl getprotocols
  ✓  00012 emitdirecttypemetadataref
  ✓  00013 llvm getelementptrinst getindexedtype
  ✓  00014 enum in generic type
  ✓  00015 no stacktrace
  ✓  00016 swift typebase getcanonicaltype
  ✓  00017 llvm foldingset llvm attributesetnode nodeequals
  ✓  00018 swift irgen emitpolymorphicarguments
  ✓  00019 llvm instvisitor
  ✓  00020 swift typechecker conformstoprotocol
     lots of fuzzing crashes omitted for README.md readability …
  ✓  26957 swift functiontype get
  ✓  26966 swift parentype get
  ✓  26970 swift abstractstoragedecl makeaddressedwithobservers
  ✓  26975 swift constraints solution solution
  ✓  26978 swift typebase getcanonicaltype
  ✓  26983 swift archetypebuilder potentialarchetype isbetterarch
  ✓  26986 swift modulefile maybereadforeignerrorconvention
  ✓  26990 swift importdecl findbestimportkind
  ✓  26992 swift archetypetype getnew
  ✓  26993 swift valuedecl settype
  ✓  26998 std function func setboundvarstypeerror
  ✓  26999 swift genericsignature profile
  ✓  27000 swift typebase gettypevariables
  ✓  27002 swift pattern clone
  ✓  27005 vtable
  ✓  27006 formatdiagnostictext
  ✓  27008 llvm optional swift diagnostic operator
  ✓  27011 swift typechecker validatetype
  ✓  27012 swift constraints constraintsystem solvesimplified
  ✓  27013 mapsignaturefunctiontype
  ✓  27014 swift modulefile loadextensions
  ✓  27021 swift constraints constraintgraph removeconstraint
  ✓  27027 swift namelookup lookupinmodule
  ✓  27028 swift nominaltypedecl preparelookuptable
  ✓  27035 swift constraints constraintgraph unbindtypevariable
  ✓  27036 swift astvisitor
  ✓  27040 swift clangimporter loadextensions
  ✓  27041 swift type walk
  ✓  27042 swift conformancelookuptable expandimpliedconformances
  ✓  27047 swift inflightdiagnostic
  ✓  27049 swift markasobjc
  ✓  27059 swift optionaltype get
  ✓  27061 swift archetypebuilder getallarchetypes
  ✓  27069 swift tupletype get
  ✓  27071 swift nominaltypedecl computeinterfacetype
  ✓  27072 swift createimplicitconstructor
  ✓  27076 swift declcontext getlocalconformances
  ✓  27078 swift abstractclosureexpr setparams
  ✓  27080 swift typechecker typecheckpattern
  ✓  27085 swift protocoldecl existentialconformstoselfslow
  ✓  27089 swift typebase getcanonicaltype
  ✓  27091 swift typechecker validatedecl
  ✓  27096 void
  ✓  27100 swift genericsignature getcanonical
  ✓  27101 swift constraints constraintgraph gatherconstraints
  ✓  27103 swift typebase getanyoptionalobjecttype
  ✓  27109 swift diagnosticengine flushactivediagnostic
  ✓  27111 swift valuedecl getoverloadsignature
  ✓  27115 swift constraints constraintsystem simplifytype
  ✓  27118 swift archetypebuilder potentialarchetype gettype
  ✓  27119 void
  ✓  27123 swift valuedecl getoverloadsignature
  ✓  27132 swift availabilityinference applyinferredavailableattr
  ✓  27135 swift patternbindingdecl setpattern
  ✓  27136 swift constructordecl setbodyparams
  ✓  27138 swift nominaltypedecl getdeclaredtypeincontext
  ✓  27142 swift constraints constraintsystem simplifyconstraint
  ✓  27146 llvm foldingset swift structtype nodeequals
  ✓  27152 swift lexer getlocforendoftoken
  ✓  27157 swift type transform
  ✓  27159 swift protocoldecl existentialconformstoselfslow
  ✓  27167 swift valuedecl overwritetype
  ✓  27169 swift typechecker validategenericfuncsignature
  ✓  27170 swift protocoltype canonicalizeprotocols
  ✓  27175 llvm foldingset swift tupletype nodeequals
  ✓  27177 swift funcdecl setdeserializedsignature
  ✓  27189 swift archetypebuilder maptypeintocontext
  ✓  27197 std function func swift type subst
  ✓  27203 swift typeloc iserror
  ✓  27208 swift archetypebuilder potentialarchetype isbetterarch
  ✓  27215 llvm smallvectorimpl swift protocolconformance operato
  ✓  27225 swift polymorphicfunctiontype get
  ✓  27229 swift constraints constraintgraph computeconnectedcomp
  ✓  27234 swift protocoldecl existentialtypesupportedslow
  ✓  27236 swift typechecker typecheckbinding
  ✓  27255 llvm ondiskchainedhashtable swift modulefile decltable
  ✓  27264 swift modulefile maybereadgenericparams
  ✓  27269 void
  ✓  27270 swift astcontext loadextensions
  ✓  27284 swift associatedtypedecl associatedtypedecl
  ✓  27286 swift extensiondecl getmembers
  ✓  27294 swift existentialmetatypetype get
  ✓  27300 swift unboundgenerictype get
  ✓  27314 swift markasobjc
  ✓  27330 swift conformancelookuptable lookupconformance
  ✓  27361 llvm foldingset swift constraints constraintlocator no
  ✓  27368 swift modulefile lookupvalue
  ✓  27380 swift lexer kindofidentifier
  ✓  27386 swift cantype isobjcexistentialtypeimpl
  ✓  27392 swift constraints constraintsystem finalize
  ✓  27402 std function func checkaccessibility
  ✓  27404 swift constraints constraintlocator profile
  ✓  27425 swift substitutedtype get
  ✓  27435 swift constraints solution solution
  ✓  27437 llvm smallvectorimpl swift diagnosticargument operator
  ✓  27438 swift typechecker checkinheritanceclause
  ✓  27441 swift metatypetype get
  ✓  27443 matchwitness
  ✓  27445 swift type subst
  ✓  27448 swift nominaltypedecl computeinterfacetype
  ✓  27449 swift constraints constraintsystem solverec
  ✓  27455 swift modulefile loadextensions
  ✓  27456 swift abstractclosureexpr setparams
  ✓  27457 llvm tinyptrvector swift valuedecl push back
  ✓  27467 vtable
  ✓  27468 swift funcdecl isunaryoperator
  ✓  27477 swift archetypebuilder potentialarchetype getarchetype
  ✓  27480 void
  ✓  27485 swift bracestmt create
  ✓  27487 swift sourcemanager addnewsourcebuffer
  ✓  27489 swift typechecker checkgenericarguments
  ✓  27497 swift decl walk
  ✓  27498 swift typechecker typecheckpatternbinding
  ✓  27500 swift constructordecl constructordecl
  ✓  27506 swift modulefile gettype
  ✓  27509 swift inflightdiagnostic
  ✓  27513 swift typeloc iserror
  ✓  27514 swift constraints constraintsystem getconstraintlocato
  ✓  27529 swift typechecker gettypeofrvalue
  ✓  27536 swift namelookup findlocalval visitbracestmt
  ✓  27545 swift nominaltypedecl classifyasoptionaltype
  ✓  27553 swift conformancelookuptable getconformingcontext
  ✓  27556 swift genericfunctiontype get
  ✓  27566 swift constraints constraintgraphscope constraintgraph
  ✓  27571 swift inflightdiagnostic
  ✓  27574 llvm foldingset swift tupletype nodeequals
  ✓  27584 swift typechecker isdeclavailable
  ✓  27587 llvm foldingset swift classtype nodeequals
  ✓  27588 swift constraints constraintsystem simplifyconstraint
  ✓  27590 swift generictypeparamtype get
  ✓  27596 llvm foldingset swift enumtype nodeequals
  ✓  27601 swift inflightdiagnostic
  ✓  27602 swift inflightdiagnostic
  ✓  27610 swift conformancelookuptable lookupconformances
  ✓  27613 swift patternbindingdecl hasstorage
  ✓  27619 swift modulefile getdecl
  ✓  27629 swift associatedtypedecl associatedtypedecl
  ✓  27631 swift nominaltypedecl getmembers
  ✓  27632 swift typechecker typecheckdecl
  ✓  27637 swift typechecker checkunsupportedprotocoltype
  ✓  27660 no stacktrace
  ✓  27672 swift dependentmembertype get
  ✓  27675 vtable
  ✓  27677 std function func swift constraints constraintsystem s
  ✓  27680 swift structtype get
  ✓  27685 swift pattern foreachvariable
  ✓  27691 void
  ✓  27693 swift constraints constraintsystem opengeneric
  ✓  27700 swift modulefile loadallmembers
  ✓  27731 swift removeshadoweddecls
  ✓  27732 swift valuedecl getinterfacetype
  ✓  27736 void
  ✓  27743 swift constraints constraintsystem solvesimplified
  ✓  27748 swift conformancelookuptable getimplicitprotocols
  ✓  27761 swift archetypebuilder addgenericsignature
  ✓  27767 swift constructordecl constructordecl
  ✓  27768 swift typechecker lookupunqualified
  ✓  27771 swift typebase isequal
  ✓  27776 swift unqualifiedlookup unqualifiedlookup
  ✓  27779 swift abstractstoragedecl getobjcgetterselector
  ✓  27784 swift printingdiagnosticconsumer handlediagnostic
  ✓  27787 swift typechecker overapproximateosversionsatlocation
  ✓  27799 swift modulefile getimportedmodules
  ✓  27803 swift typechecker validatedecl
  ✓  27816 control flow pattern match tuples
  ✓  27819 addnestedrequirements
  ✓  27820 swift silwitnessvisitor visitprotocoldecl
  ✓  27901 swift typechecker getwitnesstype
  ✓  27944 swift astvisitor
  ✓  27947 swift parser parsebraceitems
  ✓  27964 swift conformancelookuptable compareprotocolconformanc
  ✓  27965 llvm foldingset swift tupletype nodeequals
  ✓  27967 swift valuedecl getoverloadsignature
  ✓  27985 traversal visit
  ✓  28045 swift typechecker typecheckpatternbinding
  ✓  28065 swift constraints constraintsystem mergeequivalencecla
  ✓  28149 addcurriedselftype
  ✓  28182 anonymous namespace favorcalloverloads
  ✓  28183 swift typebase isequal
  ✓  28187 llvm foldingset swift constraints constraintlocator
  ✓  28189 swift valuedecl settype
  ✓  28192 swift genericfunctiontype get
  ✓  28194 swift abstractstoragedecl isgettermutating
  ✓  28196 swift constraints constraintgraph addconstraint
  ✓  28197 swift typebase getdesugaredtype
  ✓  28200 swift typebase getdesugaredtype
  ✓  28203 swift typebase getdesugaredtype
  ✓  28206 swift typechecker validatedecl
  ✓  28207 swift dependentgenerictyperesolver resolveselfassociat
  ✓  28208 swift specializedprotocolconformance gettypewitnesssub
  ✓  28213 swift expr walk
  ✓  28216 swift expr propagatelvalueaccesskind
  ✓  28217 swift diagnosticengine emitdiagnostic
  ✓  28219 swift lvaluetype get
  ✓  28230 swift constraints constraintsystem simplifyrestrictedc
  ✓  28239 swift declcontext lookupqualified
  ✓  28241 swift valuedecl isaccessiblefrom
  ✓  28244 swift valuedecl isinstancemember
** Results: 65 of 3357 tests crashed the compiler **

License

All files in this repository are distributed under the terms of the MIT license (see LICENSE).