diff --git a/test/synthetic/Makefile b/test/synthetic/Makefile index 916cb3108..11afb4df5 100644 --- a/test/synthetic/Makefile +++ b/test/synthetic/Makefile @@ -2,7 +2,7 @@ ifndef CC CC=gcc endif -all: controlflow.o data.o functions.o +all: controlflow.o data.o functions.o ub.o controlflow.o: controlflow.c $(CC) -c controlflow.c @@ -13,5 +13,8 @@ data.o: data.c functions.o: functions.c $(CC) -c functions.c +ub.o: ub.c + $(CC) -c ub.c + clean: - rm -rf controlflow.o data.o functions.o uninit.o + rm -rf controlflow.o data.o functions.o ub.o diff --git a/test/synthetic/ub.c b/test/synthetic/ub.c new file mode 100644 index 000000000..15ce319b6 --- /dev/null +++ b/test/synthetic/ub.c @@ -0,0 +1,10 @@ +int buffer_overflow() { int x[10]; return x[100]; } +int division_by_zero() { return 100 / 0; } +int no_return() {} +int null_pointer() { int *p = 0; return *p; } +int *pointer_arithmetic() { static int buf[10]; return buf + 100; } +int shift_overrun(int x) { return x << 123; } +int shift_negative() { return -1 << 1; } +int signed_int_overrun() { int x = ~0; return x * 2; } +void string_literal() { *((char *)"hello") = 0; } +int uninit() { int x; return x + 2; }