-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fixes [SR-78] swift compiler seg fault #291
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
Conversation
Uses the aligned_alloc C function from the stdlib instead of malloc so that incase the alignMask is larger than what the system supports we do not get unnecessary crashes.
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.
@manavgabhawala I prefer not to merge this change because it has a bunch of changes to different files. Some of the commit messages are not informative, like "Update Heap.cpp", twice. Please submit a new pull request with a single commit that includes a fix for a single issue with a testcase. |
@@ -2032,6 +2032,10 @@ SILType irgen::getSingletonAggregateFieldType(IRGenModule &IGM, | |||
// If there's only one stored property, we have the layout of its field. | |||
auto allFields = structDecl->getStoredProperties(); | |||
auto field = allFields.begin(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to check for empty here?
if (allFields.empty()) {
return SILType();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Sorry about the multiple commits, I was trying to get my feet wet. I created a new clean pull request and included the suggestion by @AlexDenisov. Moved to #293 |
…xtended-tests Revert "Fix compilation warnings in extended test suite"
Add Xcode 10.1 configuration to project_precommit_check
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).