1 // RUN: %clangxx -w -fsanitize=signed-integer-overflow,nullability-return,returns-nonnull-attribute -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s 2 3 #include <stdint.h> 4 #include <stdio.h> 5 h()6int *_Nonnull h() { 7 // CHECK: nullability-return 8 return NULL; 9 } 10 11 __attribute__((returns_nonnull)) i()12int *i() { 13 // CHECK: nonnull-return 14 return NULL; 15 } 16 17 __attribute__((noinline)) f(int x,int y)18int f(int x, int y) { 19 // CHECK: mul-overflow 20 return x * y; 21 } 22 23 __attribute__((noinline)) g(int x,int y)24int g(int x, int y) { 25 // CHECK: mul-overflow 26 return x * (y + 1); 27 } 28 main()29int main() { 30 h(); 31 i(); 32 int x = 2; 33 for (int i = 0; i < 10; ++i) 34 x = f(x, x); 35 x = 2; 36 for (int i = 0; i < 10; ++i) 37 x = g(x, x); 38 // CHECK-NOT: mul-overflow 39 } 40