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

Fix issue 16046 - ScopedAllocator does not set prev, causing segfaults #4742

Merged
merged 1 commit into from Aug 24, 2016

Conversation

andralex
Copy link
Member

This is a simpler fix than #4702.

@dlang-bot
Copy link
Contributor

dlang-bot commented Aug 22, 2016

Fix Bugzilla Description
16046 ScopedAllocator does not set prev, causing segfaults

@dlang-bot
Copy link
Contributor

@andralex, thanks for your PR! By analyzing the annotation information on this pull request, we identified @9rnsr, @JesseKPhillips and @WalterBright to be potential reviewers. @9rnsr: The PR was automatically assigned to you, please reassign it if you were identified mistakenly.

(The DLang Bot is under development. If you experience any issues, please open an issue at its repo.)

@codecov-io
Copy link

codecov-io commented Aug 22, 2016

Current coverage is 88.79% (diff: 100%)

Merging #4742 into master will increase coverage by <.01%

@@             master      #4742   diff @@
==========================================
  Files           121        121          
  Lines         74159      74167     +8   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          65845      65859    +14   
+ Misses         8314       8308     -6   
  Partials          0          0          

Powered by Codecov. Last update 0538d0c...54a5e49

@andralex
Copy link
Member Author

How do I see the lines covered with the Codecov tool?

@wilzbach
Copy link
Member

wilzbach commented Aug 22, 2016

How do I see the lines covered with the Codecov tool?

Either click on the "0538d0c...1b96629" diff link above or if you want the annotation directly in the GitHub diff you can install their browser extension:

https://github.com/codecov/browser-extension

edit: the failures seem unrelated (maybe due to CircleCi failing), so perhaps just rebasing to the latest master branch will solve this?

@andralex
Copy link
Member Author

reviews pliz pliz

@@ -89,6 +89,8 @@ struct ScopedAllocator(ParentAllocator)
toInsert.prev = null;
toInsert.next = root;
toInsert.length = n;
assert(!root || !root.prev);
Copy link
Member

Choose a reason for hiding this comment

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

Quite recently there was a longer discussion on a PR about the ~200 HALTs in Phobos that come without message, but segfault. Maybe we could tell the user at least what has gone wrong?
e.g. "Invalid allocation. Root node isn't at the top of the stack"

Copy link
Contributor

Choose a reason for hiding this comment

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

On top of the doubly-linked list actually ;-)
As we are at this, I'd suggest to add "Please, file an issue" or something like that, because if the assertion triggers, it's not a precondition gone wrong from the user, but rather an implementation bug.

Copy link
Member

Choose a reason for hiding this comment

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

This will be a regular assert, not a HALT, because it's not compile-time zero.

@lodo1995
Copy link
Contributor

Looks good, modulo the note by Sebastian.

auto bar = alloc.make!int(2).enforce;
alloc.dispose(foo);
alloc.dispose(bar); // segfault here
}
Copy link
Member

@wilzbach wilzbach Aug 23, 2016

Choose a reason for hiding this comment

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

Maybe we can add another test and deallocate in non-list order?
e.g.

alloc.dispose(el2);
alloc.dispose(el3);
alloc.dispose(el1);
alloc.dispose(el4);

@wilzbach
Copy link
Member

wilzbach commented Aug 23, 2016

Looks good, modulo the note by Sebastian.

Yep this looks a lot better than #4702 and if I could, I would pull this one ;-)

@andralex
Copy link
Member Author

@wilzbach gave you rights

@wilzbach wilzbach assigned wilzbach and unassigned 9rnsr Aug 23, 2016
@wilzbach
Copy link
Member

@wilzbach gave you rights

Thanks! As this PR is quite young (1 day) and I don't want to mess up my first merge at Phobos, I'll give this PR another day, s.t. everyone has a fair opportunity to shout ;-)

@wilzbach
Copy link
Member

Auto-merge toggled on

@wilzbach wilzbach merged commit 7ab18cd into dlang:master Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants