Commit Graph

1575 Commits

Author SHA1 Message Date
Joe Groff
da26c54c06 IRGen: Preserve associated types and witness tables in NecessaryBindings.
Fixes crasher #003 (rdar://problem/18232605). This time, also increase the buffer size for the necessary bindings so we don't clobber memory.

Swift SVN r22118
2014-09-19 04:00:58 +00:00
Joe Pamer
f9db2f0c9d When checking conformances, if we fail to find a witness for one associated type member refrain from attempting to resolve the others.
(If any other associated type member has a dependency on the invalid one, we won't be able to substitute and the compiler will crash.)

This addresses crash suite scenario 035. (rdar://problem/18233020)

Swift SVN r22116
2014-09-19 03:25:35 +00:00
Joe Pamer
ffc37729c8 Revert "IRGen: Preserve associated types and witness tables in NecessaryBindings."
This reverts commit r22108

Swift SVN r22115
2014-09-19 02:49:17 +00:00
Joe Pamer
783a8c6247 Prohibit type declarations within generic functions, which were causing the compiler to crash.
You'll notice that we already had tests that made it appear that such declarations could work,
but they were only avoiding crashes because downstream errors were already marking the
enclosing functions as invalid. (If the errors were fixed, they would also crash the compiler.)

This addresses crash suite scenario 018. (rdar://problem/18299547)

Swift SVN r22109
2014-09-19 00:18:43 +00:00
Joe Groff
b0dea1625f IRGen: Preserve associated types and witness tables in NecessaryBindings.
Fixes crasher #003 (rdar://problem/18232605).

Swift SVN r22108
2014-09-19 00:06:18 +00:00
Joe Groff
bee33a060c Sema: Ban pattern bindings without variables in globals and properties.
There's no real use for declaring a property or global variable without binding it to anything, and closure context mangling relies on having a name to associate with closures. Fixes crash suite #006 (rdar://problem/18232699).

Swift SVN r22105
2014-09-18 22:59:58 +00:00
Joe Pamer
b2891be810 When performing module lookups, respect the resolution mode when deciding whether or not to validate any found declarations.
Doing so prevents another common source of stack overflows in the validator, and addresses crash suite scenarios 002 and 004.
(rdar://problem/18232499, rdar://problem/18232668)

Swift SVN r22104
2014-09-18 22:51:34 +00:00
Joe Pamer
1ea993c317 If the generic type parameters of a class or struct declaration are invalid or otherwise broken, we should treat the declaration as invalid, and be more careful about doing anything that could lead to the creation of bogus archetypes. (Such as implicit constructor/destructor generation, or conformance checking.)
This addresses crash suite scenario 022. (rdar://problem/18232772)

Swift SVN r22095
2014-09-18 20:10:02 +00:00
Joe Pamer
436e135d3d Prevent another stack overflow in the type checker by avoiding recursively validating generic parameter lists. (rdar://problem/18072109 and crash suite scenario 021.)
Swift SVN r22094
2014-09-18 20:10:00 +00:00
Joe Pamer
dd141c7cad Account for recursive validation when checking if an existential conforms to itself. (rdar://problem/18042380)
This can only occur when validating mutually recursive existentials in type reference expressions, so it's "safe" to avoid validating member value decls in this case. There are still potential holes in our mechanism for checking for unsupported existentials, but at least this will eliminate another common crasher. (Crash suite scenario 010.)

Swift SVN r22035
2014-09-17 20:23:41 +00:00
Joe Groff
d3702950af SILGen: Materialize class-constrained "self" parameters when passed to non-class-constrained protocol methods.
Fixes rdar://problem/17480006, rdar://problem/17557409, rdar://problem/17929884 and crash suite #019.

Swift SVN r21981
2014-09-16 21:12:40 +00:00
Joe Groff
041c179e01 SIL: Continue type lowering after address-only fields of aggregates.
Now that we rely on type lowering to catch recursive value types, this optimization is no longer valid. Fixes rdar://problem/18232757 (crash suite #015).

Swift SVN r21967
2014-09-16 04:55:44 +00:00
Joe Groff
1c4e08a9c8 Fix up a tangle of issues related to reabstraction.
- A spot fix in SILGen for reabstracting the result of a downcast, which fixes checked casts to function types.
- Associate the layout information in type metadata records with the most abstract representation of the type. This is the correct thing to do in cases where we need the metadata as a tag for an opaque value--if we store a value in an Any, or pass it as an unconstrained generic parameter, we must maximally reabstract it. This fixes the value semantics of existentials containing trivial metatypes.
- To ensure that we get runtime layout of structs and enums correct when they contain reabstractable types, introduce a "metadata for layout" concept, which doesn't need to describe the canonical metadata for the type, but only needs to describe a type with equivalent layout and value semantics. This is a correctness fix that allows us to correctly lay out generic types containing dependent tuples and functions, and although we don't really take advantage of it here, it's also a potential runtime performance win down the road, because we could potentially produce direct metadata for a primitive type that's layout-equivalent with a runtime-instantiated type. To aid in type safety here, push SILType deeper into IRGen in places where we potentially care about specific representations of types.
- Finally, fix an inconsistency between the runtime and IRGen's concept of what spare bits unmanaged references and thick metatypes have.

Together, these fixes address rdar://problem/16406907, rdar://problem/17822208, rdar://problem/18189508, and likely many other related issues, and also fixes crash suite cases 012 and 024.

Swift SVN r21963
2014-09-16 01:44:34 +00:00
Doug Gregor
f7458a8e05 Update compiler-crashers testsuite r21946
Swift SVN r21952
2014-09-15 21:00:17 +00:00
Joe Pamer
ede74dd90e When solving for call witness argument conversions, post diagnostics in the case of failures rather than raise an assertion. This addresses crash suite issue 040. (rdar://problem/18233081)
Swift SVN r21852
2014-09-10 22:28:03 +00:00
Dmitri Hrybenko
2c93cf71f0 Mark compiler_crashers/036-lisp-style.swift as passing
Swift SVN r21833
2014-09-10 08:07:47 +00:00
Joe Pamer
9bbf4ac5fe Improve diagnostic so as not to mystify users.
Swift SVN r21824
2014-09-10 01:52:07 +00:00
Joe Pamer
acce45bdc8 Lock down existential metatype to metatype coercions. Since they're currently unsupported, we'll display a semantic error rather than crash.
This addresses crash suite scenarios 011 and 013. (rdar://problem/17777218, rdar://problem/18232728)

Swift SVN r21822
2014-09-10 00:54:34 +00:00
Joe Pamer
aeef7f736f Now that we now longer crash, reinstate test.
Swift SVN r21818
2014-09-10 00:05:29 +00:00
Joe Pamer
fa692976f5 If an expression fails to type check, and there were no failures posted or constraints to mine for a reason, we can be fairly certain that the reason for the failure was a lack of contextual type data. In this case, we should post a diagnostic rather than let the failure slip through. This addresses crash suite scenarios 001, 005, 020 and 045. (rdar://problem/16712071, rdar://problem/17317691, rdar://problem/17317691)
You'll notice that emitting this diagnostic will make some already noisy closure-related errors slightly more so. This is unfortunate, but for the time-being it's better than crashing.

Swift SVN r21817
2014-09-09 23:58:59 +00:00
Jordan Rose
e5bfd3c5dd [test] Mark three known crashers as "XFAIL: asan".
We're going to crash anyway, we'll fix it when we fix the main issue, and
the main issue isn't memory-error-related. Should unblock the ASan bot.

Swift SVN r21814
2014-09-09 22:46:56 +00:00
Dmitri Hrybenko
decff06131 Remove the test that is duplicate with
test/IRGen/mixed_objc_native_protocol_constraints.swift

Swift SVN r21804
2014-09-09 06:55:24 +00:00
Mishal Awadah
e5ca8be1a0 Add README with details on swift-compiler-crashes community repo.
Swift SVN r21717
2014-09-04 18:21:03 +00:00
Mishal Awadah
798315edd5 Add recent crasher test case from swift-compiler-crashes.
Swift SVN r21716
2014-09-04 18:21:02 +00:00
Mishal Awadah
d8ce0b80cb Add basic compilation tests from swift-compiler-crashes (https://github.com/practicalswift/swift-compiler-crashes.git)
Swift SVN r21693
2014-09-04 01:06:26 +00:00