Skip to content

add three tests for unions in structs #7278

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
Oct 31, 2022
Merged

add three tests for unions in structs #7278

merged 1 commit into from
Oct 31, 2022

Conversation

kroening
Copy link
Member

These tests pass with the built-in solver but fail with three different errors when using SMT.

  • 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).
  • n/a 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.

@codecov
Copy link

codecov bot commented Oct 27, 2022

Codecov Report

Base: 78.03% // Head: 78.03% // No change to project coverage 👍

Coverage data is based on head (e2ee2d6) compared to base (21e3260).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7278   +/-   ##
========================================
  Coverage    78.03%   78.03%           
========================================
  Files         1624     1624           
  Lines       187405   187405           
========================================
  Hits        146249   146249           
  Misses       41156    41156           

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.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

I don't mind seeing this merged, but maybe we just want to fix the issues right away?

Comment on lines 1 to 15
#include <assert.h>

struct s {
union U {
char b[2];
};
};

int main() {
struct s X;
__CPROVER_assert(X.b[1] == 2, "should fail");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't fail anymore with #7230, but even now only fails with z3. Works fine with the in-tree SMT solver.

Comment on lines 1 to 16
#include <assert.h>

struct s {
char a;
union U {
char c;
char b[2];
} u;
} X = { 1, 2 };

int main() {
__CPROVER_assert(X.u.b[1] == 123, "should fail");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only fails with z3, works fine with the in-tree SMT solver.

These tests pass with the built-in solver but fail with three different
errors when using SMT.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants