Skip to content

Fix asserts and crashes caused by skipping function bodies or allowing errors #37701

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

Merged
merged 6 commits into from
Jun 2, 2021

Conversation

bnbarham
Copy link
Contributor

I ran the stress tester locally with the new TestModule request and found a few new asserts and crashes. I'll run it again with these changes to see if it finds any more. Might actually be able to enable by default - with skipping all function bodies and WMO enabled it took ~30 minutes locally, which includes actually building the projects.

@bnbarham bnbarham requested review from akyrtzi and xymus May 29, 2021 02:34
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

bnbarham commented Jun 1, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 1, 2021

Build failed
Swift Test Linux Platform
Git Sha - 5a5ba65bb0392f567e91ab4d45594706d312226e

@bnbarham
Copy link
Contributor Author

bnbarham commented Jun 1, 2021

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented Jun 1, 2021

Build failed
Swift Test OS X Platform
Git Sha - 5a5ba65bb0392f567e91ab4d45594706d312226e

@bnbarham
Copy link
Contributor Author

bnbarham commented Jun 1, 2021

@swift-ci please test macOS platform

Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good but we should try to drop completely invalid code earlier, like a destructor on a source file. I don't think there's value to preserve these for the AllowModuleWithCompilerErrors use cases and it may require a decent amount of maintenance to keep this working.

bnbarham added 4 commits June 2, 2021 11:44
When allowing errors any attribute could be on any decl, so don't verify
whether an attribute can appear on a decl. Note that these attributes
aren't serialized anyway since they'll be set to invalid during
typechecking and hence skipped.
Most invalid attributes are skipped from serialization entirely, but
custom attributes don't have their invalid bit set - the particular
custom attribute (eg. a property wrapper) is requested when needed and
skipped if invalid. Those checks can't set the invalid bit since the
attribute could be a different custom attribute (eg. a result builder).
Note that deserialization already handles this case when recovery is
enabled.
@bnbarham
Copy link
Contributor Author

bnbarham commented Jun 2, 2021

Good point @xymus, thanks. I've changed the serialization to just skip destructors if they're invalid and we're allowing errors. I also added a further comment to the attribute commits - invalid attributes are already skipped, so:

  1. the verification is a little superfluous (typechecking already has that check)
  2. CustomAttr is a little special in that it isn't set to invalid and is thus serialized (hence the skip during deserialization)

@swift-ci please test

Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants