Skip to content

Conversation

@tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Feb 5, 2021

The changes of a8592a7 made the C front-end introduce byte updates to
ensure compliance with the behaviour of popular compilers when
initialising unions. As byte updates aren't part the C language, dump-c
must make sure such union initialisers using byte updates do not end up
in the (re-)generated output.

db4f25c was the first step in dump-c in this direction, and 3a24545
introduced further rules. The CSmith test generated with random seed
1612048908, however, demonstrated that dump-c's handling still didn't
cover all cases of byte_update expressions introduced by the C
front-end. This commit now handles those further cases.

The regression test is a minified version of that CSmith test.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@NlightNFotis
Copy link
Contributor

Thanks for this! We had a similar issue crop up in https://github.com/diffblue/cbmc/runs/1830186932. Is that also a related issue?

On a more general note, I'm not very familiar with CSmith. Is there any material to quickly familiarise myself with it to that I can interpret those reports better, or is it better if I get to spend more time diving deeper on it?

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #5799 (cfeb536) into develop (5fd8562) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5799   +/-   ##
========================================
  Coverage    69.72%   69.72%           
========================================
  Files         1242     1242           
  Lines       100907   100908    +1     
========================================
+ Hits         70361    70363    +2     
+ Misses       30546    30545    -1     
Flag Coverage Δ
cproversmt2 43.38% <ø> (ø)
regression 66.69% <100.00%> (+<0.01%) ⬆️
unit 32.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/goto-instrument/dump_c.cpp 79.54% <100.00%> (+0.03%) ⬆️
src/goto-instrument/goto_program2code.cpp 68.04% <0.00%> (+0.12%) ⬆️

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 5fd8562...cfeb536. Read the comment docs.

@tautschnig
Copy link
Collaborator Author

Thanks for this! We had a similar issue crop up in https://github.com/diffblue/cbmc/runs/1830186932. Is that also a related issue?

It's the very same issue and should be fixed by this PR.

On a more general note, I'm not very familiar with CSmith. Is there any material to quickly familiarise myself with it to that I can interpret those reports better, or is it better if I get to spend more time diving deeper on it?

CSmith lives here: https://embed.cs.utah.edu/csmith/ - but our scripts/csmith.sh might be all that you'd need to look at.

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.

I'm not sure if I see how this fixes the issue and the commit message doesn't say but it seems like the kind of change that would.

The changes of a8592a7 made the C front-end introduce byte updates to
ensure compliance with the behaviour of popular compilers when
initialising unions. As byte updates aren't part the C language, dump-c
must make sure such union initialisers using byte updates do not end up
in the (re-)generated output.

db4f25c was the first step in dump-c in this direction, and 3a24545
introduced further rules. The CSmith test generated with random seed
1612048908, however, demonstrated that dump-c's handling still didn't
cover all cases of byte_update expressions introduced by the C
front-end. This commit now handles those further cases.

The regression test is a minified version of that CSmith test.
@tautschnig
Copy link
Collaborator Author

I'm not sure if I see how this fixes the issue and the commit message doesn't say but it seems like the kind of change that would.

Thank you for calling this out! I have updated the text of the commit message (and also the pull request summary) to hopefully clarify what is going on here.

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.

Much clearer. Thank you!

@martin-cs martin-cs merged commit 8745e42 into diffblue:develop Feb 11, 2021
@tautschnig tautschnig deleted the dump-union3 branch February 11, 2021 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants