-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
unused var causes copying of resource type #2408
Comments
I suspect the no-implicit-copies proposal fixes this. |
in theory, resources ought not to be copyable in the first place. |
y is a last-use of x, though, so it isn't a copy, it's a move, right? |
indeed. I presume then that this is a bug in trans, where the last_use information is not being used and so a copy is induced. |
hmm, my theory may not hold water. it's not clear to me why using y would prevent the error, then. |
It looks like the bug is in the code for initializing locals when it has been determined that they can be kept off of the stack. As it turns out, basically the only way to keep liveness from saying something needs to be kept on the stack is for it to be unused. I'm just going to fix this by getting rid of the stuff where we avoid spilling variables. It never seems to get used and llvm can do it anyways. |
@msullivan is this bug specifically in the code that you will be deleting? or is it some more general thing in the treatment of immediates? |
I believe the bug is specifically in the code for immediate local variable initialization, but similar bugs might lurk elsewhere. |
make test-cargo-miri only about cargo Move the things that actually test dependency behavior into the regular test suite, now that we can do that. :)
This commit adds an `out_file` to the benchcomp visualizes that emit output (currently just one visualization, dump_yaml). This is to allow different visualizations to be written to different output files, including stdout. The intention (for a future commit) is that CI will save certain visualizations as artifacts, which users can then download.
The following program prints "0\n0\n", when it should print "0\n":
The same effect occurs if you rename y to _y to eliminate the unused variable warning. The same effect does not occur if you use y, eg the following program has correct behavior:
The use of a record with a mutable field is also not essential to the bug; I used it to demonstrate that the bug is actually due to copying, and not running the destructor twice on the same value.
The text was updated successfully, but these errors were encountered: