Skip to content

bv_cbmct::unbounded_arrayt::U_AUTO is never enabled #2018

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

Open
tautschnig opened this issue Apr 6, 2018 · 0 comments
Open

bv_cbmct::unbounded_arrayt::U_AUTO is never enabled #2018

tautschnig opened this issue Apr 6, 2018 · 0 comments

Comments

@tautschnig
Copy link
Collaborator

While seemingly meant to be the default (only never/always can be set via the command line), the default is actually U_NONE. Enabling it is trivial, but will break lots of examples until #1086 is complete and merged. Furthermore it seems current code only looks at the top-level size, not the nested values. Below is a patch that may be a useful starting point:

diff --git a/src/cbmc/cbmc_solvers.cpp b/src/cbmc/cbmc_solvers.cpp
index ab69f9b..caf40be 100644
--- a/src/cbmc/cbmc_solvers.cpp
+++ b/src/cbmc/cbmc_solvers.cpp
@@ -110,6 +110,8 @@ std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_default()
     bv_cbmc->unbounded_array=bv_cbmct::unbounded_arrayt::U_NONE;
   else if(options.get_option("arrays-uf")=="always")
     bv_cbmc->unbounded_array=bv_cbmct::unbounded_arrayt::U_ALL;
+  else
+    bv_cbmc->unbounded_array=bv_cbmct::unbounded_arrayt::U_AUTO;

   solver->set_prop_conv(std::move(bv_cbmc));

diff --git a/src/solvers/flattening/boolbv.cpp b/src/solvers/flattening/boolbv.cpp
index 4cf43a0..503be96 100644
--- a/src/solvers/flattening/boolbv.cpp
+++ b/src/solvers/flattening/boolbv.cpp
@@ -689,17 +689,20 @@ bool boolbvt::is_unbounded_array(const typet &type) const
   if(unbounded_array==unbounded_arrayt::U_ALL)
     return true;

+#if 0
   const exprt &size=to_array_type(type).size();

   mp_integer s;
   if(to_integer(size, s))
     return true;
+#endif

+  bool retval=false;
   if(unbounded_array==unbounded_arrayt::U_AUTO)
-    if(s>MAX_FLATTENED_ARRAY_SIZE)
-      return true;
+    if(boolbv_width(type)>MAX_FLATTENED_ARRAY_SIZE)
+      retval=true;

-  return false;
+  return retval;
 }

 void boolbvt::print_assignment(std::ostream &out) const
tautschnig added a commit to tautschnig/cbmc that referenced this issue Apr 25, 2018
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue Apr 13, 2019
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue May 29, 2019
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue May 30, 2019
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue Jun 1, 2019
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue May 20, 2021
Previously, the command line permitted setting uninterpreted functions to
"never" or "always", where "never" actually was the default. The "automatic"
mode could not be enabled in any way.

Furthermore the limit should apply across all dimensions of an array, not just
the top-level size.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue Dec 8, 2022
Previously, the command line permitted setting uninterpreted functions
to "never" or "always", where "never" actually was the default. The
"automatic" mode could not be enabled in any way.

This reverts diffblue#6232, but now includes additional changes to the array
theory to handle nested struct members no different from members of a
top-level struct.

Fixes: diffblue#2018
tautschnig added a commit to tautschnig/cbmc that referenced this issue Dec 8, 2022
Previously, the command line permitted setting uninterpreted functions
to "never" or "always", where "never" actually was the default. The
"automatic" mode could not be enabled in any way.

This reverts diffblue#6232, but now includes additional changes to the array
theory to handle nested struct members no different from members of a
top-level struct.

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

Successfully merging a pull request may close this issue.

1 participant