Julian Seward 97c1ddae79 Merge exp-ptrcheck/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10469
2009-07-15 14:50:22 +00:00

20 lines
502 B
C

#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/time.h>
int main(void)
{
int i = 11; int fd = open("/dev/null", O_WRONLY);
char* buf = malloc(sizeof(char) * 6);
char c = buf[-1]; // LoadStoreErr
char* x = buf + (long)buf; // ArithErr
char* y = (char*)((long)buf * i); // AsmErr
write(fd, buf+3, 5); // SysParamErr
close(fd);
return x-y+c;
}