Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / ubsan_minimal / TestCases / recover-dedup.cpp
blobb7c9ddc3e5cfbda65a552195a07a705b9f2e18e7
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
3 #include <stdint.h>
4 #include <stdio.h>
6 int *_Nonnull h() {
7 // CHECK: nullability-return by 0x{{[[:xdigit:]]+$}}
8 return NULL;
11 __attribute__((returns_nonnull))
12 int *i() {
13 // CHECK: nonnull-return by 0x{{[[:xdigit:]]+$}}
14 return NULL;
17 __attribute__((noinline))
18 int f(int x, int y) {
19 // CHECK: mul-overflow by 0x{{[[:xdigit:]]+$}}
20 return x * y;
23 __attribute__((noinline))
24 int g(int x, int y) {
25 // CHECK: mul-overflow by 0x{{[[:xdigit:]]+$}}
26 return x * (y + 1);
29 int 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