svcomp_openbsd_cmemrchr_alloca.c

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:15.0
disk size 721 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
#include <stdlib.h>

extern int __VERIFIER_nondet_int(void);

/*
 * Reverse memchr()
 * Find the last occurrence of 'c' in the buffer 's' of size 'n'.
 */
void *
cmemrchr(const void *s, int c, size_t n)
{
	const unsigned char *cp;

	if (n != 0) {
		cp = (unsigned char *)s + n;
		do {
			if (*(--cp) == (unsigned char)c)
				return((void *)cp);
		} while (--n != 0);
	}
	return(NULL);
}

int main() {
  int length = __VERIFIER_nondet_int();
  int n = __VERIFIER_nondet_int();
  int c = __VERIFIER_nondet_int();
  if (length < 1) {
      length = 1;
  }
  if (n < 1) {
      n = 1;
  }
  char* nondetArea = (char*) alloca(n * sizeof(char));
  cmemrchr(nondetArea, c, n);
  return 0;
}
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark