Skip to content

Add overflow_result_exprt: compute result and overflow in one expression #6903

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
Jun 3, 2022

Conversation

tautschnig
Copy link
Collaborator

Doing both the arithmetic operation and determining whether or not there
was an overflow previously required either multiple expressions or going
via __builtin_X_overflow, which should be specific to the C front-end.

The new expression returns a struct with two components, the first of
which has the type of the arithmetic operation, and the second is
Boolean.

Fixes: #6841

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

@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #6903 (5ea97b3) into develop (577b0ec) will decrease coverage by 0.04%.
The diff coverage is 54.08%.

@@             Coverage Diff             @@
##           develop    #6903      +/-   ##
===========================================
- Coverage    77.81%   77.77%   -0.05%     
===========================================
  Files         1568     1568              
  Lines       179975   180315     +340     
===========================================
+ Hits        140044   140234     +190     
- Misses       39931    40081     +150     
Impacted Files Coverage Δ
src/solvers/flattening/boolbv.h 62.50% <ø> (ø)
src/util/bitvector_expr.cpp 58.55% <0.00%> (-35.65%) ⬇️
src/util/simplify_expr_class.h 90.47% <ø> (ø)
src/solvers/flattening/boolbv_overflow.cpp 43.94% <35.65%> (-4.74%) ⬇️
src/util/simplify_expr.cpp 83.08% <51.37%> (-2.66%) ⬇️
src/solvers/smt2/smt2_conv.cpp 67.39% <57.14%> (+0.13%) ⬆️
.../goto-instrument/goto_instrument_parse_options.cpp 70.90% <73.33%> (-0.23%) ⬇️
src/goto-programs/goto_convert_side_effect.cpp 95.13% <94.59%> (-0.41%) ⬇️
src/ansi-c/c_typecheck_base.cpp 81.15% <95.23%> (+2.27%) ⬆️
src/util/bitvector_expr.h 97.24% <95.65%> (-0.10%) ⬇️
... and 12 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 aad7825...5ea97b3. Read the comment docs.

The SAT back-end assumed that all struct/union expressions had a tag
instead of the full type, which is not actually a GOTO program
invariant.
Doing both the arithmetic operation and determining whether or not there
was an overflow previously required either multiple expressions or going
via `__builtin_X_overflow`, which should be specific to the C front-end.

The new expression returns a struct with two components, the first of
which has the type of the arithmetic operation, and the second is
Boolean.

Fixes: diffblue#6841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce an overflow irep that takes lvalues as arguments
2 participants