Skip to content

Commit 00cbad7

Browse files
author
Daniel Kroening
committed
test for va_args
1 parent 0cec13d commit 00cbad7

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

regression/cbmc/va_list3/main.c

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <stdio.h>
2+
#include <stdarg.h>
3+
#include <assert.h>
4+
5+
void foo(int n, ...);
6+
7+
int main()
8+
{
9+
foo(1, 1u);
10+
foo(2, 2l);
11+
foo(3, 3.0);
12+
return 0;
13+
}
14+
15+
void foo(int n, ...)
16+
{
17+
va_list vl;
18+
19+
va_start(vl,n);
20+
21+
switch(n)
22+
{
23+
case 1: assert(va_arg(vl, unsigned)==1); break;
24+
case 2: assert(va_arg(vl, long)==2); break;
25+
case 3: assert(va_arg(vl, double)==3.0); break;
26+
}
27+
28+
va_end(vl);
29+
}

regression/cbmc/va_list3/test.desc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
KNOWNBUG
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

0 commit comments

Comments
 (0)