[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-bugs] c-reduce varargs support



Hello,

I have issues with reducing a testcase that includes varargs.

Currently, running creduce just reduces it with initial passes by removing all #includes along with <stdarg.h> and then fails with 6% improvement, on which the script no longer returns zero (and obviously can't be compiled). I tried skipping the initial passes, but then I get even more bizarre results.

Is this a known issue or something you're planning to support?

Thanks in advance,
Ondrej
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

void abort(void);
void exit(int);

void vafunction(char *dummy, ...) {
  double darg;
  int iarg;
  int flag = 0;
  int i;
  va_list ap;

  va_start(ap, dummy);
  for (i = 1; i <= 18; i++, flag++) {
    if (flag & 1) {
      darg = va_arg(ap, double);
      if (darg != (double)i)
        abort();
    } else {
      iarg = va_arg(ap, int);
      if (iarg != i)
        abort();
    }
  }
  va_end(ap);
}

int main(void) {
  vafunction("", 1, 2., 3, 4., 5, 6., 7, 8., 9, 10., 11, 12., 13, 14., 15, 16.,
             17, 18.);
  exit(0);
  return 0;
}