Skip to content

Fix C enum output #4226

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 2 commits into from
Feb 21, 2019
Merged

Conversation

peterschrammel
Copy link
Member

This fixes the basic bugs that cause crashes at the moment.
Going forward this to-string-conversion code needs a complete overhaul as we are currently fixing the same bugs in three different places.

Tests coming...

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

if(src.type().id() == ID_c_enum)
width = to_bitvector_type(to_c_enum_type(src.type()).subtype()).get_width();
else
width = to_bitvector_type(src.type()).get_width();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will still fail if you have an ID_c_enum_tag... I'd actually use pointer_offset_bits to compute the width.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: f9b3690).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101379672

The subtype must be used.
bvrep2integer must be used.
@peterschrammel peterschrammel merged commit 628f776 into diffblue:develop Feb 21, 2019
@peterschrammel peterschrammel deleted the fix-c-enum-output branch February 21, 2019 21:23
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