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
Fixup for 9975: swap and pointsTo #1390
Conversation
They are by spec. The whole idea of structs is to have them bit-copyable (or movable). I'm not sure who/what and when should check that though. |
Yes, structs should be bit moveable. However, the fact that they may have an internal pointer is not guaranteed wrong code. For example, a struct might just so happen to reference an array, and be a part of that same array. Also, power coder can rely on moving things with internal pointers. It is a way, for example, to implement node insertion by intializing the sentinel node with internal pointing, then moving* the sentinel into the target node, while keeping valid pointers to the sentinel. More problematically though, pointsTo, is currently returning false positives (in case of unions), which means we can't make assertions (just in case). So while I agree with you that internal pointers will usually lead to pain and suffering, I don't think it is swap's job to halt a program because it detects a potentially dangerous situation. *Just noticed move has the same problem, which also needs fixing. |
Rebased. Could I get a second opinion on this? There these asserts are creating problems: |
2/3 of these report look like playing with raw memory in a wrong way but the first one is clean-cut bug. |
I would, but I submitted this, so I can't. Woe is me. |
@andralex: IIRC, this is your design, so do you have any comments on the issue? Imho, it's pretty clear that alias analysis can't work in a binary way in an environment that allows for bitwise data reinterpretation (for example, but not limited to, using unions), but I'm not sure whether introducing two In assertions such as the ones discussed here |
One problem we have is that we don't know (or at least I) don't know how to write
Still, as evidenced in the original error report, it is currently not possible to sort I think the best course of action is the implementation of a |
Re-ping? There are some signs of broken merge. |
Fixing 9975 revealed that checking `pointsTo` was creating problems in swap for legitimate use cases. This is because: 1. pointsTo can sometimes create "false positives" 2. Internal pointing is not outright forbidden, it is just that the runtime is allowed to make the assumption they don't exist. While swapping aliasing objects is a sign of stink, it should still "just work".
as well as remove erroneous documentation.
Fixed. |
I going to merge, it fixes an issue with no other apparent workarounds. |
Fixup for 9975: swap and pointsTo
I don't agree with this solution that disables all checking for the sake of |
A "definitely points to"? When I submitted the pull, I didn't know how I'd write such a thing. However, using Kenji's "isMutable" template re-write that handles unions, I think I have a better idea on how to handle it. I'll give it a try. |
I've formalized the change I'm thinking of into an ER. I'll get on it in a couple of weeks, when I get the time. |
|
Fixing 9975 (http://d.puremagic.com/issues/show_bug.cgi?id=9975) revealed that checking
pointsTo
was creating problems in swap for legitimate use cases.This is because:
While swapping aliasing objects is a sign of stink, it should still "just work".