Skip to content

Commit 6ee8f9d

Browse files
committed
C23 keywords
This adds scanner, parser and typechecker support for the new C23 keywords.
1 parent 0b000a3 commit 6ee8f9d

34 files changed

+422
-95
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
About
77
=====
88

9-
CBMC is a Bounded Model Checker for C and C++ programs. It supports C89, C99,
10-
most of C11 and most compiler extensions provided by gcc and Visual Studio. It
11-
also supports SystemC using Scoot. It allows verifying array bounds (buffer
12-
overflows), pointer safety, exceptions and user-specified assertions.
13-
Furthermore, it can check C and C++ for consistency with other languages, such
14-
as Verilog. The verification is performed by unwinding the loops in the program
15-
and passing the resulting equation to a decision procedure.
9+
CBMC is a Bounded Model Checker for C and C++ programs. It supports C89,
10+
C99, most of C11, C17, C23 and most compiler extensions provided by gcc and
11+
Visual Studio. It also supports SystemC using Scoot. It allows verifying
12+
array bounds (buffer overflows), pointer safety, exceptions and
13+
user-specified assertions. Furthermore, it can check C and C++ for
14+
consistency with other languages, such as Verilog. The verification is
15+
performed by unwinding the loops in the program and passing the resulting
16+
equation to a decision procedure.
1617

1718
For full information see [cprover.org](http://www.cprover.org/cbmc).
1819

doc/architectural/front-page.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ website</a>; contributors should use the
88
<a href="https://github.com/diffblue/cbmc">repository</a> hosted on GitHub. CBMC
99
is part of CProver.
1010

11-
CBMC is a Bounded Model Checker for C and C++ programs. It supports C89, C99,
12-
most of C11 and most compiler extensions provided by gcc and Visual Studio. It
13-
also supports SystemC using Scoot. It allows verifying array bounds (buffer
14-
overflows), pointer safety, arithmetic exceptions and user-specified assertions.
15-
Furthermore, it can check C and C++ for consistency with other languages, such
16-
as Verilog. The verification is performed by unwinding the loops in the program
17-
and passing the resulting equation to a decision procedure.
11+
CBMC is a Bounded Model Checker for C and C++ programs. It supports C89,
12+
C99, most of C11, C17, C23 and most compiler extensions provided by gcc and
13+
Visual Studio. It also supports SystemC using Scoot. It allows verifying
14+
array bounds (buffer overflows), pointer safety, arithmetic exceptions and
15+
user-specified assertions. Furthermore, it can check C and C++ for
16+
consistency with other languages, such as Verilog. The verification is
17+
performed by unwinding the loops in the program and passing the resulting
18+
equation to a decision procedure.
1819

1920
For further information see [cprover.org](http://www.cprover.org/cbmc).
2021

doc/man/cbmc.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ set include file (C/C++)
154154
\fB\-D\fR macro
155155
define preprocessor macro (C/C++)
156156
.TP
157-
\fB\-\-c89\fR, \fB\-\-c99\fR, \fB\-\-c11\fR
157+
\fB\-\-c89\fR, \fB\-\-c99\fR, \fB\-\-c11\fR, \fB\-\-c17\fR, \fB\-\-c23\fR
158158
set C language standard (default: c11)
159159
.TP
160160
\fB\-\-cpp98\fR, \fB\-\-cpp03\fR, \fB\-\-cpp11\fR

doc/man/goto-analyzer.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ set include file (C/C++)
425425
\fB\-D\fR macro
426426
define preprocessor macro (C/C++)
427427
.TP
428-
\fB\-\-c89\fR, \fB\-\-c99\fR, \fB\-\-c11\fR
428+
\fB\-\-c89\fR, \fB\-\-c99\fR, \fB\-\-c11\fR, \fB\-\-c17\fR, \fB\-\-c23\fR
429429
set C language standard (default: c11)
430430
.TP
431431
\fB\-\-cpp98\fR, \fB\-\-cpp03\fR, \fB\-\-cpp11\fR

regression/cbmc/_BitInt/_BitInt1.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// _BitInt is a C23 feature
2+
3+
// sizeof
4+
static_assert(sizeof(unsigned _BitInt(1)) == 1);
5+
static_assert(sizeof(_BitInt(32)) == 4);
6+
static_assert(sizeof(_BitInt(33)) == 8);
7+
static_assert(sizeof(_BitInt(65)) == 16);
8+
static_assert(sizeof(_BitInt(128)) == 16);
9+
10+
int main()
11+
{
12+
return 0;
13+
}

regression/cbmc/_BitInt/_BitInt1.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
_BitInt1.c
3+
--c23
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

regression/cbmc/_BitInt/_BitInt2.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// _BitInt is a C23 feature
2+
#include <assert.h>
3+
4+
int main()
5+
{
6+
// casts
7+
// assert((_BitInt(4))17 == 1);
8+
// assert((_BitInt(4)) - 1 == -1);
9+
// assert((unsigned _BitInt(4)) - 1 == 15);
10+
11+
// promotion (or lack thereof)
12+
// assert((unsigned _BitInt(4))15 + (unsigned _BitInt(4))1 == 0);
13+
// assert((unsigned _BitInt(4))15 + (unsigned _BitInt(5))1 == 16);
14+
// assert((unsigned _BitInt(4))15 + (signed _BitInt(5))1 == -16);
15+
// assert((unsigned _BitInt(4))15 + 1 == 16);
16+
17+
return 0;
18+
}

regression/cbmc/_BitInt/_BitInt2.desc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
KNOWNBUG
2+
_BitInt2.c
3+
--c23
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
_BitInt implementation is missing.

regression/cbmc/_BitInt/_BitInt3.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// _BitInt is a C23 feature
2+
#include <assert.h>
3+
4+
int main()
5+
{
6+
// pointers
7+
_BitInt(3) x, *p = &x;
8+
*p = 1;
9+
10+
return 0;
11+
}

regression/cbmc/_BitInt/_BitInt3.desc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
KNOWNBUG
2+
_BitInt3.c
3+
--c23
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
_BitInt implementation is missing.

0 commit comments

Comments
 (0)