brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a7b3b75 Raw
31 lines · c
1// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow,integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero | FileCheck %s2 3int f(int x, int y) {4  // CHECK: %[[B1:.*]] = icmp ne i32 %[[D:.*]], 05  // CHECK: %[[B2:.*]] = icmp ne i32 %[[N:.*]], -21474836486  // CHECK: %[[B3:.*]] = icmp ne i32 %[[D]], -17  // CHECK: %[[B4:.*]] = or i1 %[[B2]], %[[B3]]8  // CHECK: br i1 %[[B1]], label %[[L1:[0-9a-z_.]*]], label %[[L2:[0-9a-z_.]*]]9 10  // {{^|:}} used to match both Debug form of the captured label11  // cont:12  // and Release form13  // ; <label>:1414  // But avoids false matches inside other numbers such as [114 x i8].15  // CHECK: {{^|:}}[[L2]]16  // CHECK-NEXT: call void @llvm.ubsantrap(i8 3)17  // CHECK-NEXT: unreachable18 19  // CHECK: {{^|:}}[[L1]]20  // CHECK-NEXT: br i1 %[[B4]], label %[[L3:[0-9a-z_.]*]], label %[[L4:[0-9a-z_.]*]]21 22  // CHECK: {{^|:}}[[L4]]23  // CHECK-NEXT: zext24  // CHECK-NEXT: zext25  // CHECK-NEXT: __ubsan_handle_divrem_overflow26 27  // CHECK: {{^|:}}[[L3]]28  // CHECK-NEXT: sdiv i32 %[[N]], %[[D]]29  return x / y;30}31