-
Notifications
You must be signed in to change notification settings - Fork 273
fix type inconsistencies when using temporary #2498
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
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: dec622c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77781049
@@ -3184,10 +3184,6 @@ void java_bytecode_convert_methodt::save_stack_entries( | |||
{ | |||
for(auto &stack_entry : stack) | |||
{ | |||
// remove typecasts if existing | |||
while(stack_entry.id()==ID_typecast) |
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.
So this will cause the code below to get hit much less often (looking for symbol, or deref, or member operator at top level) -- what is the upshot of this? Did this code ever have tests? If not this bug surely cries out for some, perhaps requested from @mgudemann as the original author?
@kroening How about the following fix (tested on the above class from Tika)
so we unwrap the typecasts in an auxiliary variable, check the base expression for its identifier, ID_dereference or component name and then modify the stack entry but keep the original casts? |
see #2507 |
I am concerned that the problem is deeper -- on the stack, there might be an arbitrarily complicated expression, say s.th. like 1+7*SOME_VAR, and SOME_VAR gets modified. I.e., I think the 'search' needs to do a full expression traversal. |
Ok, I see the point. We could write an expression visitor that looks for the 4 different cases on the stack. That doesn't sound too difficult to do. Would that need one visitor to read and another to actually do the change or can that be done in one go? |
Three lambda functions should do the trick, like this:
(Perhaps also check the type of the struct). No need for any visitor or the like to do the change, simply substitute the entire stack entry. |
done in #2507 |
Triggers type inconsistency in bitand expression in
org.apache.tika.io.LookaheadInputStream.read()