Skip to content

Commit

Permalink
test for va_args
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kroening committed Sep 19, 2017
1 parent 0cec13d commit 00cbad7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
29 changes: 29 additions & 0 deletions regression/cbmc/va_list3/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>

void foo(int n, ...);

int main()
{
foo(1, 1u);
foo(2, 2l);
foo(3, 3.0);
return 0;
}

void foo(int n, ...)
{
va_list vl;

va_start(vl,n);

switch(n)
{
case 1: assert(va_arg(vl, unsigned)==1); break;
case 2: assert(va_arg(vl, long)==2); break;
case 3: assert(va_arg(vl, double)==3.0); break;
}

va_end(vl);
}
8 changes: 8 additions & 0 deletions regression/cbmc/va_list3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KNOWNBUG
main.c

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring

0 comments on commit 00cbad7

Please sign in to comment.