Currently, I am using Frama-C version 19, and struggling with variadic arguments. For example)
#include <stdarg.h>
#include <stddef.h>
void vars2(int n, va_list args) {
for (size_t i = 0; i < n; ++i) {
int tmp = va_arg(args, int);
}
};
void vars(int n, ...) {
va_list args;
va_start(args, n);
vars2(n, args);
va_end(args);
};
int main(void) {
vars(5, 1, 2, 3, 4, 5);
return 0;
}
I am getting warning of '[eva:alarm] main.c:6: Warning: out of bounds read. assert \valid_read(args)'. Is there any way to write pre-condition for args in above code? I tried to cast to void and int, but did not help much. Many thanks for the help in advance.
BRs, Jaesu Yu