Skip to content

Do not generate enum-value checks for function call left-hand sides #6594

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 4 commits into from
Feb 7, 2022

Conversation

tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Jan 19, 2022

We already disabled these checks for assignment left-hand sides, but
need to do the same for function calls. Else we'd be asserting validity
before the value has been assigned.

Fixes: #6586

Co-authored-by: Ilia Levin [email protected]

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

@tautschnig tautschnig changed the title Bugfixes/6586 enum check Do not generate enum-value checks for function call left-hand sides Jan 19, 2022
@tautschnig tautschnig force-pushed the bugfixes/6586-enum-check branch from e325e86 to c78b8b4 Compare January 19, 2022 12:06
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #6594 (7e0f829) into develop (b17a993) will increase coverage by 0.01%.
The diff coverage is 98.26%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6594      +/-   ##
===========================================
+ Coverage    76.72%   76.73%   +0.01%     
===========================================
  Files         1579     1579              
  Lines       181938   181999      +61     
===========================================
+ Hits        139587   139652      +65     
+ Misses       42351    42347       -4     
Impacted Files Coverage Δ
.../goto-instrument/goto_instrument_parse_options.cpp 69.24% <ø> (ø)
src/goto-instrument/unwind.h 100.00% <ø> (ø)
src/util/arith_tools.cpp 85.63% <50.00%> (+3.19%) ⬆️
src/util/simplify_expr_boolean.cpp 91.15% <97.43%> (+2.26%) ⬆️
src/analyses/goto_check_c.cpp 90.81% <100.00%> (+0.17%) ⬆️
src/ansi-c/ansi_c_declaration.cpp 74.07% <100.00%> (ø)
src/goto-instrument/cover_basic_blocks.cpp 90.76% <100.00%> (+0.07%) ⬆️
src/goto-instrument/unwind.cpp 100.00% <100.00%> (ø)
src/goto-programs/builtin_functions.cpp 56.86% <100.00%> (+0.05%) ⬆️
src/linking/linking.cpp 58.99% <100.00%> (ø)
... and 4 more

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 8b7bed6...7e0f829. Read the comment docs.

@tautschnig tautschnig force-pushed the bugfixes/6586-enum-check branch 3 times, most recently from 6c7034f to e746171 Compare January 28, 2022 09:04
@tautschnig tautschnig force-pushed the bugfixes/6586-enum-check branch 2 times, most recently from d4a3707 to 318b31f Compare February 1, 2022 14:02
tautschnig and others added 4 commits February 6, 2022 22:37
We should not have to fall back to irept pretty printing for these.
We already disabled these checks for assignment left-hand sides, but
need to do the same for function calls. Else we'd be asserting validity
before the value has been assigned.

Fixes: diffblue#6586, diffblue#6451

Co-authored-by: Ilia Levin <[email protected]>
The assertions generated by --enum-range-check must not apply to
the expansion of __CPROVER_enum_is_in_range, for those would assert
exactly the same. Also, those expressions are rather costly: for N enum
values, N assertions would be generated.
Disjunctions over equalities of integer constants can be rewritten as
closed intervals. This will most commonly appear when expanding
enum_is_in_range.

This also surfaced a bug in to_integer, which used the wrong type
reference.
@tautschnig tautschnig force-pushed the bugfixes/6586-enum-check branch from 318b31f to 7e0f829 Compare February 6, 2022 22:40
@peterschrammel peterschrammel removed their assignment Feb 7, 2022
@tautschnig tautschnig merged commit ee2690d into diffblue:develop Feb 7, 2022
@tautschnig tautschnig deleted the bugfixes/6586-enum-check branch February 7, 2022 10:39
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.

__CPROVER_enum_is_in_range() fails on enum value returning functions.
6 participants