Skip to content

Remove multiple function assertion #5402

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

karkhaz
Copy link
Collaborator

@karkhaz karkhaz commented Jun 30, 2020

This commit removes an assertion that triggers when multiple functions
get mangled to the same name when using the --export-file-local-symbols
flag to goto-cc.

This assertion was previously valid when compiling files one at a time, but
commit fcd1083 introduced the possibility of compiling and linking several
files at once. This is a problem when two source files both include an
implementation file, like [1], because the implementation may contain static
functions that get mangled twice.

This commit replaces the assertion with a debug message in case users would
like to check how often this happens.

This commit fixes #5380.

[1] https://github.com/awslabs/aws-c-common/blob/master/include/aws/common/atomics_gnu.inl

  • 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.

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.

As I understand emplace, the log will only be triggered if you have two things that mangle to the same name and are identical, right? If so and we have a valid use-case where this can happen (and it seems that #5398 has one) then this should be fine.

@karkhaz
Copy link
Collaborator Author

karkhaz commented Jun 30, 2020

@martin-cs that's all correct. Thank you!

This commit removes an assertion that triggers when multiple functions
get mangled to the same name when using the --export-file-local-symbols
flag to goto-cc.

This assertion was previously valid when compiling files one at a time, but
commit fcd1083 introduced the possibility of compiling and linking several
files at once. This is a problem when two source files both include an
implementation file, like [1], because the implementation may contain static
functions that get mangled twice.

This commit replaces the assertion with a debug message in case users would
like to check how often this happens.

This commit fixes diffblue#5380.

[1] https://github.com/awslabs/aws-c-common/blob/master/include/aws/common/atomics_gnu.inl
@karkhaz karkhaz force-pushed the kk-multiple-functions-possible branch from 06b02b4 to 599fd66 Compare June 30, 2020 17:05
@codecov
Copy link

codecov bot commented Jun 30, 2020

Codecov Report

Merging #5402 into develop will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5402      +/-   ##
===========================================
- Coverage    68.19%   68.19%   -0.01%     
===========================================
  Files         1176     1176              
  Lines        97517    97519       +2     
===========================================
  Hits         66502    66502              
- Misses       31015    31017       +2     
Flag Coverage Δ
#cproversmt2 42.73% <ø> (ø)
#regression 65.37% <33.33%> (-0.01%) ⬇️
#unit 32.24% <ø> (ø)
Impacted Files Coverage Δ
src/goto-programs/name_mangler.h 96.00% <33.33%> (-4.00%) ⬇️

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 faf7f43...599fd66. Read the comment docs.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Add a test?

Copy link
Contributor

@NlightNFotis NlightNFotis 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
Copy link
Contributor

@karkhaz I think that's alright. I'd rather keep the test from the previous PR however, but now I can remove the backing out of the commit.

@NlightNFotis
Copy link
Contributor

@smowton There's a test in #5398 that's relevant I believe.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

ok

@smowton
Copy link
Contributor

smowton commented Jul 1, 2020

Hang on, surely in that case that test should change from broken to working or similar? Can we add a test that would previously trip the invariant?

@NlightNFotis
Copy link
Contributor

NlightNFotis commented Jul 1, 2020

@smowton The test is working because the #5398 is removing the commit that caused the issue in the first place. Assuming this goes in, the test should be passing.

If the test gets merged first, without first backing out the previous commit or just removing the assertion like in here, then it should fail. But the test is associated, it's just the merging sequence that should matter as to whether it passes or fails.

@NlightNFotis
Copy link
Contributor

I am going ahead and merging this one. For any issues with this, ping me.

@NlightNFotis NlightNFotis merged commit d3c99f4 into diffblue:develop Jul 1, 2020
@karkhaz karkhaz deleted the kk-multiple-functions-possible branch July 1, 2020 15:07
NlightNFotis added a commit to NlightNFotis/cbmc that referenced this pull request Jul 1, 2020
This is guarding for the regression described in github
issue diffblue#5380 and fixed in github PR diffblue#5402.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Name mangling changes break goto-cc
5 participants