Skip to content
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

Fixes [SR-78] swift compiler seg fault #293

Merged
merged 4 commits into from
Dec 7, 2015
Merged

Conversation

manavgabhawala
Copy link
Contributor

Fixes SR-78 swift compiler segmentation fault. The IRGen module would crash when a generic (empty) struct was part of the source code because it tried to call std::next on an end iterator, adds in a guard to prevent against that and also adds a test case to add in this check.

Added test case that caused the old compiler to crash (I'm not sure if this is the right way to integrate it in the testing suite).

Fixes a segmentation fault where the IRGen module would crash when a
generic (empty) struct was part of the source code because it tried to
call std::next on an end iterator.
Updates to check for empty instead of checking iterator at end() for
more readability.
@tkremenek
Copy link
Member

@jckarter: can you review this?

@ghost
Copy link

ghost commented Dec 7, 2015

As the return value for this new use case (when the iterator is exhausted) is the same as when there are multiple stored properties, I would handle these in the same code path - more specifically: the only special case here is when there is a single stored property and everything else should use the main code path.

Refactored the code so that there is only a single branch for when there is one stored property and the rest return a SILType() as per @simonmpilkington suggestion.
}

struct Bar {
}

Choose a reason for hiding this comment

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

Empty end line is missing.

@jckarter
Copy link
Member

jckarter commented Dec 7, 2015

LGTM. Add the missing newline like @blackrain suggested and I'll accept.

@manavgabhawala
Copy link
Contributor Author

@jckarter I added the newline.

@jckarter
Copy link
Member

jckarter commented Dec 7, 2015

Perfect. Thanks @manavgabhawala!

jckarter added a commit that referenced this pull request Dec 7, 2015
@jckarter jckarter merged commit 825348f into apple:master Dec 7, 2015
slavapestov pushed a commit to slavapestov/swift that referenced this pull request Nov 27, 2018
Reapply "Fix compilation warnings in extended test suite".
freak4pc pushed a commit to freak4pc/swift that referenced this pull request Sep 28, 2022
Fix builder factory to handle Swift version 4.2 correctly
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.

None yet

5 participants