-
Notifications
You must be signed in to change notification settings - Fork 274
Type the operand of code_declt #3267
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
kroening
commented
Nov 3, 2018
- Each commit message has a non-empty body, explaining why the change was made.
- n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- White-space or formatting changes outside the feature-related changed lines are in commits of their own.
955f9bc
to
f537e7c
Compare
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: f537e7c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90172916
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
{ | ||
symbol_exprt tmp(symbol.name, symbol.type); | ||
|
||
if(symbol.is_lvalue) | ||
tmp.set(ID_C_lvalue, true); | ||
|
||
return std::move(tmp); | ||
return tmp; |
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.
Why is the std::move
being removed here?
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.
Perhaps counterintuitively, the std::move prevents a move here. I.e., removing it enables copy elision.
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.
Why would that be the case? Notably, clang-7 had complained about the absence of std::move
here, and it has just been introduced in 72bfc35.
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.
@tautschnig the key is whether a type conversion is required or not. Previously we returned a symbol_exprt
, meaning we needed a conversion to exprt
(via its copy- or move-constructor), so std::move
was a good thing (picking the move constructor). Now we return a symbol_exprt
, meaning no type conversion is necessary and RVO / copy/move-elision is possible, so std::move
is now a bad thing.
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.
Many thanks for the elaboration!
src/goto-instrument/dump_c.cpp
Outdated
@@ -894,7 +894,9 @@ void dump_ct::convert_global_variable( | |||
} | |||
|
|||
if(!func.empty() && !symbol.is_extern) | |||
local_static_decls[symbol.name]=d; | |||
{ | |||
local_static_decls.insert(std::pair<irep_idt, code_declt>(symbol.name, d)); |
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.
I think that's fine, but I am surprised to see this seemingly unrelated change in here. And then .emplace
would seem better?!
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.
It's related as follows: the PR enforces that a code_declt always has a symbol_typet parameter, which is not the case for a very brief time when using [] to insert an element into a map.
But will use .emplace.
f537e7c
to
35b893c
Compare
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 35b893c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90241109
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
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.
My part looks fine.
Needs a rebase. |
35b893c
to
e889df7
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: e889df7).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90402530