-
Notifications
You must be signed in to change notification settings - Fork 269
Closed
Description
Describe the bug
The CVC4 C++ API segfaults on this example and hits an assertion failure in debug:
#include "api/cvc4cpp.h"
#include <iostream>
using namespace std;
using namespace CVC4::api;
int main()
{
Solver slv;
// commenting next line removes the segfault
Solver slv2;
Sort bvsort4 = slv.mkBitVectorSort(4);
Sort bvsort8 = slv.mkBitVectorSort(8);
Sort arrsort = slv.mkArraySort(bvsort4, bvsort8);
Term arr = slv.mkConst(arrsort, "arr");
Term idx = slv.mkConst(bvsort4, "idx");
Term ten = slv.mkBitVector(8, "10", 10);
Term sel = slv.mkTerm(SELECT, arr, idx);
Term distinct = slv.mkTerm(DISTINCT, sel, ten);
cout << distinct << endl;
cout << "op:" << endl;
cout << distinct.getOp() << endl;
return 0;
}
with output:
(distinct (select arr idx) #b00001010)
op:
Fatal failure within CVC4::TypeNode CVC4::TypeNode::getArrayConstituentType() const at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/./expr/type_node.h:967
Check failure
isArray()
with trace:
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1 0x00007ffff4632864 in __GI_abort () at abort.c:79
#2 0x00007ffff714b643 in CVC4::FatalStream::~FatalStream (this=0x7fffffffdb47, __in_chrg=<optimized out>) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/base/check.cpp:33
#3 0x00007ffff602dc1c in CVC4::TypeNode::getArrayConstituentType (this=0x7fffffffdb98) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/./expr/type_node.h:967
#4 0x00007ffff72fb80f in CVC4::theory::arrays::ArraySelectTypeRule::computeType (nodeManager=0x5555555a63c0, n=..., check=false)
at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/./theory/arrays/theory_arrays_type_rules.h:43
#5 0x00007ffff72e43a9 in CVC4::expr::TypeChecker::computeType (nodeManager=0x5555555a63c0, n=..., check=false)
at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/build/src/expr/type_checker.cpp:790
#6 0x00007ffff719235a in CVC4::NodeManager::getType (this=0x5555555a63c0, n=..., check=false) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/expr/node_manager.cpp:496
#7 0x00007ffff60367d7 in CVC4::NodeTemplate<true>::getType (this=0x7fffffffde28, check=false) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/./expr/node.h:1315
#8 0x00007ffff5fe05ae in CVC4::api::Term::getKindHelper (this=0x7fffffffe170) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/api/cvc4cpp.cpp:1646
#9 0x00007ffff5fe2440 in CVC4::api::Term::getOp (this=0x7fffffffe170) at /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/src/api/cvc4cpp.cpp:1822
#10 0x000055555555678a in main () at test-cvc4.cpp:25
Command line arguments: N/A
CVC4 version/commit: Current master (b10e383)
Used git bisect to find that d23ba14 was the first bad commit.
Operating system: Ubuntu 20.04, and macOS 11.01
configure.sh options
Configured with either no options, or debug.
configure.sh output
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building Debug build
-- Performing Test HAVE_FLAG_fno_inline
-- Performing Test HAVE_FLAG_fno_inline - Success
-- Configuring with C flag '-fno-inline'
-- Configuring with CXX flag '-fno-inline'
-- Configuring with C flag '-Og'
-- Configuring with CXX flag '-Og'
-- Performing Test HAVE_FLAG_O0
-- Performing Test HAVE_FLAG_O0 - Success
-- Configuring with C flag '-O0'
-- Configuring with CXX flag '-O0'
-- Performing Test HAVE_FLAG_Wall
-- Performing Test HAVE_FLAG_Wall - Success
-- Configuring with C flag '-Wall'
-- Configuring with CXX flag '-Wall'
-- Performing Test HAVE_FLAG_fexceptions
-- Performing Test HAVE_FLAG_fexceptions - Success
-- Configuring with C flag '-fexceptions'
-- Performing Test HAVE_FLAG_Wno_deprecated
-- Performing Test HAVE_FLAG_Wno_deprecated - Success
-- Configuring with C flag '-Wno-deprecated'
-- Configuring with CXX flag '-Wno-deprecated'
-- Performing Test HAVE_FLAG_Wsuggest_override
-- Performing Test HAVE_FLAG_Wsuggest_override - Success
-- Configuring with CXX flag '-Wsuggest-override'
-- Performing Test HAVE_FLAG_Wnon_virtual_dtor
-- Performing Test HAVE_FLAG_Wnon_virtual_dtor - Success
-- Configuring with CXX flag '-Wnon-virtual-dtor'
-- Performing Test HAVE_FLAG_Wimplicit_fallthrough
-- Performing Test HAVE_FLAG_Wimplicit_fallthrough - Success
-- Configuring with C flag '-Wimplicit-fallthrough'
-- Configuring with CXX flag '-Wimplicit-fallthrough'
-- Performing Test HAVE_FLAG_Wshadow
-- Performing Test HAVE_FLAG_Wshadow - Success
-- Configuring with C flag '-Wshadow'
-- Configuring with CXX flag '-Wshadow'
-- Performing Test HAVE_FLAG_Wno_class_memaccess
-- Performing Test HAVE_FLAG_Wno_class_memaccess - Success
-- Configuring with CXX flag '-Wno-class-memaccess'
-- Using GNU gold linker.
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.6", minimum required is "3")
-- Found GMP: /usr/include/x86_64-linux-gnu
-- Found GMP libs: /usr/lib/x86_64-linux-gnu/libgmp.so
-- Performing Test HAVE_FLAG_ggdb3
-- Performing Test HAVE_FLAG_ggdb3 - Success
-- Configuring with C flag '-ggdb3'
-- Configuring with CXX flag '-ggdb3'
-- Performing Test CVC4_NEED_INT64_T_OVERLOADS
-- Performing Test CVC4_NEED_INT64_T_OVERLOADS - Failed
-- Performing Test CVC4_NEED_HASH_UINT64_T_OVERLOAD
-- Performing Test CVC4_NEED_HASH_UINT64_T_OVERLOAD - Failed
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for C++ include ext/stdio_filebuf.h
-- Looking for C++ include ext/stdio_filebuf.h - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for ffs
-- Looking for ffs - found
-- Looking for optreset
-- Looking for optreset - not found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Performing Test STRERROR_R_CHAR_P
-- Performing Test STRERROR_R_CHAR_P - Failed
-- Found Git: /usr/bin/git (found version "2.27.0")
-- Looking for antlr3FileStreamNew
-- Looking for antlr3FileStreamNew - found
-- Found ANTLR: /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/deps/install/bin/antlr3
-- Found ANTLR libs: /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/deps/install/lib/libantlr3c.a
-- Found Java: /usr/bin/java (found version "15.0.0") found components: Runtime
-- Found CxxTest: /usr/include
-- Found GTest: /usr/local/lib/libgtest.a
CVC4 1.9-prerelease
Build profile : debug
GPL : off
Best configuration : off
Optimization level : off
Assertions : on
Debug symbols : on
Debug context mem mgr : off
Dumping : on
Muzzle : off
Proofs : on
Statistics : on
Tracing : on
ASan : off
UBSan : off
TSan : off
Coverage (gcov) : off
Profiling (gprof) : off
Unit tests : on
Valgrind : off
Shared libs : on
Static binary : off
Python bindings : off
Java bindings : off
Python2 : off
ABC : off
CaDiCaL : off
CryptoMiniSat : off
drat2er : off
GLPK : off
Kissat : off
LFSC : off
LibPoly : off
BUILD_LIB_ONLY : off
MP library : gmp
Editline : off
SymFPU : off
CPPLAGS (-D...) : CVC4_DEBUG CVC4_ASSERTIONS CVC4_DUMPING CVC4_PROOF CVC4_TRACING CVC4_STATISTICS_ON
CXXFLAGS : -fno-inline -Og -O0 -Wall -Wno-deprecated -Wsuggest-override -Wnon-virtual-dtor -Wimplicit-fallthrough -Wshadow -Wno-class-memaccess -ggdb3
CFLAGS : -fno-inline -Og -O0 -Wall -fexceptions -Wno-deprecated -Wimplicit-fallthrough -Wshadow -ggdb3
Linker flags : -fuse-ld=gold
Install prefix : /usr/local
CVC4 license : modified BSD
Note that this configuration is NOT built against any GPL'ed libraries, so
it is covered by the (modified) BSD license. This is, however, not the best
performing configuration of CVC4. To build against GPL'ed libraries which
improve CVC4's performance, re-configure with '-DENABLE_GPL -DENABLE_BEST'.
Now change to 'build' and type 'make', followed by 'make check' or 'make install'.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/makaim/repos/pono/deps/smt-switch/deps/CVC4/build
Metadata
Metadata
Assignees
Labels
No labels