synthetic tests: add ub.c
This commit is contained in:
parent
0836b999cf
commit
506d1ed68d
|
@ -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
|
||||
|
|
|
@ -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; }
|
Loading…
Reference in New Issue