On Fri, 2024-03-08 at 22:17 -0800, 'Arjya Das' via CProver Support
wrote:
>
> Hi,
>
> Does the current version of CBMC support vectors and list?
Maybe. It depends which implementation of the STL you are using.
> I have set the cpp standard to c++11 (as both c++98, c++03 standard
> results in "unimplemented" error for vectors). I am getting the
> following parsing error for the regression test regression/cbmc-
> cpp/Vector1/main.cpp:
>
> CBMC version 5.95.1 (cbmc-5.95.1) 64-bit x86_64 linux
> Parsing regression/cbmc-cpp/Vector1/main.cpp
> file /usr/include/c++/12/type_traits line 67: parse error before
> 'constexpr operator value_type ('
<snip>
The problem is that most implementations of the STL use a lot of
template meta-programming. This means that to support even the most
basic code that #include <vector> with a modern, mainstream STL
implementation, you have to support a very large amount of template
code that is not really used anywhere but the internals of the STL and
maybe Boost and is completely irrelevant for what you are trying to
verify. This is a *huge* amount of work and so far no-one has been
willing to commit either the time or the funding to do it.
So what can you do?
A. Use a different STL implementation. An older one or one designed
for simpler targets might work.
B. You can write your own versions of the STL headers that you need,
maybe using the modelling features in CBMC
https://diffblue.github.io/cbmc/cprover-manual/index.html
This will likely perform much better than using a real STL.
C. At points there have been tools that translate C++ into C.
HTH
Cheers,
- Martin
--
Martin's office hours are Wednesday 14:00--16:00 in A309C or online.
They are first-come, first-served and there is no need to book.