-
Notifications
You must be signed in to change notification settings - Fork 277
Fix static symbols referencing in harness file #5412
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
Fix static symbols referencing in harness file #5412
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5412 +/- ##
===========================================
- Coverage 68.21% 68.21% -0.01%
===========================================
Files 1178 1178
Lines 97542 97550 +8
===========================================
+ Hits 66537 66542 +5
- Misses 31005 31008 +3
Continue to review full report at Codecov.
|
61e3242
to
2200d36
Compare
fabce15
to
f40631e
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.
Even when relying on magic strings, it is important to not duplicate them, as this makes them even more fragile and prone to error.
regression/goto-harness-gb-input/static-symbol-referencing/test.desc
Outdated
Show resolved
Hide resolved
f40631e
to
5bf11c8
Compare
@thk123 @hannes-steffenhagen-diffblue All of your comments have now been addressed. Can I get another review please? |
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.
Blocking comment addressed - but feel quite strongly that a test without much positive regexes is not a great test.
Done - looks like you've got a formatting problem btw |
5bf11c8
to
15d47ca
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.
I don’t particularly like that this includes a binary, but I suppose it’s better than not having a test at all.
Need to have instructions for how to recreate the goto bianry file
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.
Code change looks fine. Agree with @thk123 about the issue of binary tests. The binary format is not intended to be stable or portable.
regression/goto-harness-gb-input/static-symbol-referencing/test.desc
Outdated
Show resolved
Hide resolved
regression/goto-harness-gb-input/static-symbol-referencing/test.desc
Outdated
Show resolved
Hide resolved
15d47ca
to
3b16eb9
Compare
Hi @martin-cs @thk123 @hannes-steffenhagen-diffblue I have re-requested approvals on this - The PR was rewritten (at least the last commit that contains the test), to now address your concerns and contains a c source file as a test, and with some other shortcomings addressed. |
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 this is probably addressing @martin-cs and @thk123 comments now
@@ -1008,6 +1009,27 @@ code_blockt recursive_initializationt::build_function_pointer_constructor( | |||
for(const auto &target : targets) | |||
{ | |||
auto const assign = code_assignt{dereference_exprt{result}, target}; | |||
auto const sym_to_lookup = |
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.
Aside comment:
FWIW I think we should probably do something cleverer for function pointers, this is very similar to function pointer removal.
: ""; | ||
// skip referencing globals because the corresponding symbols in the symbol | ||
// table are no longer marked as file local. | ||
if(has_prefix(id2string(sym_to_lookup), FILE_LOCAL_PREFIX)) |
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.
The thinking here is that symbols prefixed this way might actually be referenceable, but we decided to push off potential different handling for this case off as a different feature. This is coming from --export-file-local-symbols
apparently.
regression/goto-harness-multi-file-project/static_symbols_referencing/first_one.c
Show resolved
Hide resolved
3b16eb9
to
d8ad34f
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.
Blocking problems addressed
Hi @martin-cs, can we get another review on this one? Thanks :) |
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.
@NlightNFotis Looks much better -- thank you!
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.
LGTM
This is fixing an issue we came across when trying to run
goto-harness
against the batch jobs in the https://github.com/awslabs/aws-c-common/tree/master/.cbmc-batch/jobs files, where the tool would generate harnesses that referenced static symbols in different files.