Skip to content

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

Merged

Conversation

NlightNFotis
Copy link
Contributor

@NlightNFotis NlightNFotis commented Jul 7, 2020

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.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • 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).
  • 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.

@codecov
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #5412 into develop will decrease coverage by 0.00%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             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     
Flag Coverage Δ
#cproversmt2 42.76% <ø> (ø)
#regression 65.38% <60.00%> (-0.01%) ⬇️
#unit 32.26% <ø> (ø)
Impacted Files Coverage Δ
src/goto-programs/name_mangler.h 100.00% <ø> (ø)
src/goto-programs/name_mangler.cpp 64.70% <50.00%> (ø)
src/goto-harness/recursive_initialization.cpp 89.95% <62.50%> (-0.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 069db73...d8ad34f. Read the comment docs.

@NlightNFotis NlightNFotis force-pushed the fix_static_symbols_referencing branch from 61e3242 to 2200d36 Compare July 8, 2020 10:54
@NlightNFotis NlightNFotis force-pushed the fix_static_symbols_referencing branch 3 times, most recently from fabce15 to f40631e Compare July 8, 2020 16:36
Copy link
Contributor

@thk123 thk123 left a 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.

@NlightNFotis NlightNFotis force-pushed the fix_static_symbols_referencing branch from f40631e to 5bf11c8 Compare July 9, 2020 10:55
@NlightNFotis
Copy link
Contributor Author

@thk123 @hannes-steffenhagen-diffblue All of your comments have now been addressed. Can I get another review please?

thk123
thk123 previously approved these changes Jul 9, 2020
Copy link
Contributor

@thk123 thk123 left a 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.

@thk123
Copy link
Contributor

thk123 commented Jul 9, 2020

Done - looks like you've got a formatting problem btw

@NlightNFotis NlightNFotis force-pushed the fix_static_symbols_referencing branch from 5bf11c8 to 15d47ca Compare July 9, 2020 13:41
Copy link
Contributor

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.

@thk123 thk123 dismissed their stale review July 9, 2020 15:27

Need to have instructions for how to recreate the goto bianry file

Copy link
Collaborator

@martin-cs martin-cs left a 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.

@NlightNFotis
Copy link
Contributor Author

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.

Copy link
Contributor

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 =

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))

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.

@NlightNFotis NlightNFotis force-pushed the fix_static_symbols_referencing branch from 3b16eb9 to d8ad34f Compare July 16, 2020 14:39
Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking problems addressed

@NlightNFotis
Copy link
Contributor Author

Hi @martin-cs, can we get another review on this one? Thanks :)

Copy link
Collaborator

@martin-cs martin-cs left a 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!

Copy link
Contributor

@danpoe danpoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NlightNFotis NlightNFotis merged commit febb5cf into diffblue:develop Jul 20, 2020
@NlightNFotis NlightNFotis deleted the fix_static_symbols_referencing branch February 19, 2021 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants