From 469ca6af1b8fc9e162ca45be3875c7b7b5706d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 3 Nov 2016 21:45:33 +0100 Subject: [PATCH] Add synthetic ub tests --- test/synthetic/ub.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/synthetic/ub.c b/test/synthetic/ub.c index 77993b830..9d7ffae35 100644 --- a/test/synthetic/ub.c +++ b/test/synthetic/ub.c @@ -1,8 +1,14 @@ int buffer_overflow() { int x[10]; return x[100]; } +int dead_pointer(int a) { int *p=&a; if (a) { int x; p = &x; } return *p; } int division_by_zero() { return 100 / 0; } +int float_overflow() { float f=1E100; return f; } +void negative_size(int sz) { if (sz < 0) { int buf[sz]; } } int no_return() {} int null_pointer() { int *p = 0; return *p; } int *pointer_arithmetic() { static int buf[10]; return buf + 100; } +char pointer_overflow() { static int buf[10]; return buf; } +int pointer_subtraction() { char a[10]; char b[10]; return b-a; } +int pointer_comparison() { char a[10]; char b[10]; return b> 1; return intmax * 2; }