STL support

24 views
Skip to first unread message

Arjya Das

unread,
Mar 9, 2024, 9:08:17 AM3/9/24
to CProver Support
Hi,
    
    Does the current version of CBMC support vectors and list? 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 ('
file /usr/include/c++/12/type_traits line 74: parse error before '} ; template <'
file /usr/include/c++/12/type_traits line 2091: parse error before 'struct __attribute__ ( ('
file /usr/include/c++/12/type_traits line 2093: parse error before '} ; template <'
file /usr/include/c++/12/type_traits line 2112: parse error before 'struct __attribute__ ( ('
file /usr/include/c++/12/type_traits line 2114: parse error before '} ; template <'
file /usr/include/c++/12/type_traits line 2306: parse error before '> struct __common_type_impl {'
file /usr/include/c++/12/type_traits line 2312: parse error before '} ; template <'
file /usr/include/c++/12/type_traits line 2524: parse error before '> struct __inv_unwrap {'
file /usr/include/c++/12/type_traits line 2528: parse error before '} ; template <'
PARSING ERROR

Arjya

Nyx Brain, Martin

unread,
Mar 12, 2024, 6:50:12 AM3/12/24
to cprover...@googlegroups.com
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.

Mandayam Srivas

unread,
Apr 18, 2025, 5:28:10 AMApr 18
to cprover...@googlegroups.com, Akhoury Shauryam, shobhits.mcs2023
What are the options and features that CBMC has to control the verbosity or to ellide specific parts of an error trace.  Specifically, can I ask it to suppress display of error trace at function/procedure invocation boundaries?

Thanks in advance for your information and help.

Srivas

PS

Does using CBMC in Visual Sudio Interface help matters?

Mandayam Srivas

unread,
Apr 18, 2025, 6:21:52 AMApr 18
to cprover...@googlegroups.com, Akhoury Shauryam, shobhits.mcs2023
To clarify, what I mean by "elliding" is I want to hide or suppress parts of error trace form being displayed for example at function invocation boundaries.  Thanks.

From: Mandayam Srivas <mksr...@hotmail.com>
Sent: Friday, April 18, 2025 9:28 AM
To: cprover...@googlegroups.com <cprover...@googlegroups.com>
Cc: Akhoury Shauryam <akh...@cmi.ac.in>; shobhits.mcs2023 <shobhits...@cmi.ac.in>
Subject: Elliding lines in display of error trace
 

Peter Schrammel

unread,
Apr 28, 2025, 4:00:24 PMApr 28
to cprover...@googlegroups.com

Srivas, you could use the XML (--xml-ui) or JSON (--json-ui) output options.

You could then pass the output through a postprocessor which gives you full control over what to retain (and is easier to handle than the plain text output).


Depending on what you want to do, also CBMC-Viewer could be useful: https://github.com/model-checking/cbmc-viewer


Peter

--

---
You received this message because you are subscribed to the Google Groups "CProver Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cprover-suppo...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/cprover-support/PNXP287MB40193DAF58D1E584B0073433C5BF2%40PNXP287MB4019.INDP287.PROD.OUTLOOK.COM.
Reply all
Reply to author
Forward
0 new messages