Skip to content

goto-symex: nil array size must not have a type added #5657

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
Dec 14, 2020

Conversation

tautschnig
Copy link
Collaborator

An expression has a type() member, which the nil irept lacks. Trying to
access (in a non-const context) the type() member would thus create it,
which in turn means that it no longer compares equal to a nil_exprt. As
SSA renaming did access the type() member in such a way, the type of an
array without specified size would no longer compare equal to the irept
describing the type as generated by the C front-end, which in turn made
simplification fail.

The problem was surfaced by running cbmc --unwind 2 --pointer-check
--bounds-check on
c/ldv-linux-4.2-rc1/linux-4.2-rc1.tar.xz-32_7a-drivers--gpu--drm--i915--i915.ko-entry_point.cil.out.i
from SV-COMP.

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

@@ -263,6 +263,10 @@ bool check_renaming(const exprt &expr)
if(to_ssa_expr(expr).get_original_expr().type() != type)
return true;
}
else if(expr.id() == ID_nil)
{
Copy link
Member

Choose a reason for hiding this comment

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

Is that still needed after the change in goto_symex_state.cpp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just the sanity check (when using --validate-ssa-equation) - hopefully it never fails...

{
DATA_CHECK(
vm, array_type.size() == nil_exprt{}, "array size must be an expression");
}
Copy link
Member

Choose a reason for hiding this comment

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

The message in that check could be clearer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about the updated message?

@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #5657 (b032d1a) into develop (813a0ad) will decrease coverage by 37.14%.
The diff coverage is 22.22%.

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #5657       +/-   ##
============================================
- Coverage    69.41%   32.26%   -37.15%     
============================================
  Files         1243      985      -258     
  Lines       100612    83606    -17006     
============================================
- Hits         69842    26978    -42864     
- Misses       30770    56628    +25858     
Flag Coverage Δ
cproversmt2 ?
regression ?
unit 32.26% <22.22%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/goto-symex/renaming_level.cpp 58.58% <0.00%> (-40.39%) ⬇️
src/util/std_types.cpp 51.13% <0.00%> (-38.15%) ⬇️
src/util/std_types.h 71.97% <ø> (-22.42%) ⬇️
src/util/validate_types.cpp 62.50% <50.00%> (-23.87%) ⬇️
src/goto-symex/goto_symex_state.cpp 54.63% <100.00%> (-37.09%) ⬇️
src/cpp/cpp_id.h 0.00% <0.00%> (-100.00%) ⬇️
src/cpp/cpp_scope.h 0.00% <0.00%> (-100.00%) ⬇️
src/cpp/cpp_token.h 0.00% <0.00%> (-100.00%) ⬇️
src/cpp/cpp_name.cpp 0.00% <0.00%> (-100.00%) ⬇️
src/cpp/cpp_util.cpp 0.00% <0.00%> (-100.00%) ⬇️
... and 948 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 813a0ad...b032d1a. Read the comment docs.

An expression has a type() member, which the nil irept lacks. Trying to
access (in a non-const context) the type() member would thus create it,
which in turn means that it no longer compares equal to a nil_exprt.  As
SSA renaming did access the type() member in such a way, the type of an
array without specified size would no longer compare equal to the irept
describing the type as generated by the C front-end, which in turn made
simplification fail.

The problem was surfaced by running cbmc --unwind 2 --pointer-check
--bounds-check on
c/ldv-linux-4.2-rc1/linux-4.2-rc1.tar.xz-32_7a-drivers--gpu--drm--i915--i915.ko-entry_point.cil.out.i
from SV-COMP.
@kroening kroening merged commit 1b29b67 into diffblue:develop Dec 14, 2020
@tautschnig tautschnig deleted the nil-size branch December 14, 2020 14:28
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.

2 participants