Skip to content

Dump-C: support struct/union types without tags #7162

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
merged 1 commit into from
Sep 30, 2022

Conversation

tautschnig
Copy link
Collaborator

Dump-C assumed that all occurrences of struct or union types would be via their tags. This was never a documented invariant, but largely true until 5ea97b3: that commit does introduce struct types in place, without making any effort to create tags. Dump-C now supports this case.

Fixes: #7158

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


int main()
{
calloc(10, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't quite get why this creates a structure rather than an array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment added.

CORE
main.c
--dump-c
=(\(signed int \*\))?42
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 42? I mean, in some ways, of course, 42! But...

Dump-C assumed that all occurrences of struct or union types would be
via their tags. This was never a documented invariant, but largely true
until 5ea97b3: that commit does introduce struct types in place,
without making any effort to create tags. Dump-C now supports this case.

Fixes: diffblue#7158
@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Base: 77.89% // Head: 77.82% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (7d5801f) compared to base (f37f3c0).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7162      +/-   ##
===========================================
- Coverage    77.89%   77.82%   -0.08%     
===========================================
  Files         1576     1578       +2     
  Lines       181913   182242     +329     
===========================================
+ Hits        141699   141824     +125     
- Misses       40214    40418     +204     
Impacted Files Coverage Δ
src/solvers/smt2/smt2_conv.cpp 65.17% <0.00%> (-3.54%) ⬇️
src/util/pointer_expr.cpp 78.44% <0.00%> (-3.11%) ⬇️
src/goto-instrument/dump_c.cpp 80.00% <0.00%> (-0.87%) ⬇️
src/ansi-c/c_typecheck_expr.cpp 73.90% <0.00%> (-0.25%) ⬇️
src/ansi-c/expr2c.cpp 67.13% <0.00%> (ø)
src/solvers/smt2/smt2_conv.h 100.00% <0.00%> (ø)
src/util/simplify_expr_pointer.cpp 85.83% <0.00%> (ø)
src/solvers/flattening/bv_pointers.cpp 85.80% <0.00%> (ø)
src/solvers/smt2_incremental/smt_solver_process.h 100.00% <0.00%> (ø)
...ment/synthesizer/loop_invariant_synthesizer_base.h 100.00% <0.00%> (ø)
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig tautschnig merged commit d94c1cf into diffblue:develop Sep 30, 2022
@tautschnig tautschnig deleted the bugfixes/7158-dump-c branch September 30, 2022 06:42
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.

Invariant violation with --dump-c
3 participants