-
Notifications
You must be signed in to change notification settings - Fork 273
goto trace contains ssa information it shouldn't #902
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
Comments
@tautschnig I see you've edited some of the code in build_goto_trace() (the one with five arguments) in goto-symex/build_goto_trace.cpp, which is where I think the problem is. Do you understand it enough to decide if my hypothesis is correct, and if so how to fix it? |
What I know very little about is how the test suite output and the goto trace relate - does the test output extract strings from the trace? |
Yes, the only parameter the test output takes is the goto trace, so I'm fairly sure it does. This bug is also exhibited in the interpreter output, which is generated by reading the goto trace. |
To be more precise, the lines of the test suite are generated here: https://github.com/diffblue/cbmc/blob/master/src/cbmc/bmc_cover.cpp#L460 . The sections just after the equals sign are output here: https://github.com/diffblue/cbmc/blob/master/src/cbmc/bmc_cover.cpp#L140 . So they are coming directly from the goto trace. |
I dug into this a bit more. The Without understanding this code very well, it seems to me that @tautschnig Does this make any sense? If so, any ideas how to fix the problem? Or any ideas who else to ask, if you don't know? |
My apologies for not attending to this in a while. For a start, it should be noted that it's not just test-input that contains the L0/L1 identifiers, but the same is true for the counter-example trace. I would suggest to discuss with @kroening whether this is a bug or a feature. I'd lean towards the latter as this information is essential to distinguish multiple objects that the address may be taken of. If this is a bug of some sorts, or at least considered a bug in test-input generation, then take a look at what the full tree representation available at the time of generating the output is. For example.
That is, you have the full ssa_exprt at hand (as an operand to address_of). If removing the L0/L1 labeling is the right thing to do, then you'd want to do:
Hope this helps! |
The calls into the back-end (solvers/flattening) look roughly as expected and I would expect the solver / back-end to handle things with the SSA name, rather than the original / program name.
This matches my expectation (FWIW). I believe the trace should exist at the level of goto-programs and be independent of how it was generated (i.e. these can be built from BMC SSA, IIRC symex also builds them using a different symex engine (see #749), IMPARA builds them).
This seems plausible.
Yes; the SSA naming has to be present within the formula that the bmc symex creates and so access to / from the variables in the formula should use the SSA naming. The removal should be done outside the solver when the model is being converted to a trace. |
I can see why dynamically created objects need to be numbered and why their numbering is more / different to the SSA numbering and should persist through the conversion to a goto trace but I can't see that the pointer variables would need this numbering. |
It's completely up to the code generating the output to decide what is appropriate. The SSA information is persisted all the way, so (as indicated in my comment) people may choose to build the output in any way deemed most appropriate. |
@tautschnig The code snippet you gave seems to not work on functions with parameters that are arrays |
Would you have an example code snippet? |
It seems my patch had a syntax error anyway. The below appears to work:
|
Thanks @tautschnig , that works. I'm going to make a PR to test-gen-support to merge this, but in a slightly different place so it actually affects the goto trace. |
I've thought of a better way of showing what I think the problem is. Make a file with this as its contents:
Run
To me this doesn't make sense. In state 28 we're assigning Maybe the problem here is just that the inputs get the ssa ids removed, in which case we could perhaps make a list of them and only amend variable names in address-of expressions when they are one of the inputs. |
I may be repeating myself: please discuss this with @kroening. As far as I am aware it is a conscious decision to output in the way it is done (i.e., with L0/L1 SSA indices as only then an object can be uniquely identified), and thus it might mainly be a matter of providing suitable documentation. |
Steps to reproduce:
Actual results:
In the output, the following lines appear.
Expected results:
The variable names in the address-of expressions shouldn't have the "!0" suffixes.
Discussion:
The "!0" are used in the ssa phase to indicate the thread, but they should have been removed when the ssa-trace was transformed into goto-trace. I think that this isn't working for address-of expression on the right hand side.
The text was updated successfully, but these errors were encountered: