| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| #if __cplusplus == 199711L | ||
| #define NOTHROW throw() | ||
| #else | ||
| #define NOTHROW noexcept(true) | ||
| #endif | ||
|
|
||
| namespace dr593 { // dr593: 2.8 | ||
|
|
||
| void f(); | ||
| void fence() NOTHROW; | ||
|
|
||
| struct A { | ||
| ~A() try { | ||
| f(); | ||
| } catch (...) { | ||
| fence(); | ||
| } | ||
| }; | ||
|
|
||
| void g() { | ||
| A(); | ||
| } | ||
|
|
||
| } // namespace dr593 | ||
|
|
||
| // CHECK: call void @dr593::fence()() | ||
| // CHECK-NEXT: invoke void @__cxa_rethrow() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| namespace dr605 { // dr605: 2.7 | ||
|
|
||
| template <class T> | ||
| static T f(T t) {} | ||
|
|
||
| template <> | ||
| int f(int t) {} | ||
|
|
||
| void g(int a) { | ||
| f(a); | ||
| } | ||
|
|
||
| } // namespace dr605 | ||
|
|
||
| // CHECK: define internal {{.*}} i32 @int dr605::f<int>(int) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| #if __cplusplus == 199711L | ||
| #define NOTHROW throw() | ||
| #else | ||
| #define NOTHROW noexcept(true) | ||
| #endif | ||
|
|
||
| namespace dr650 { // dr650: 2.8 | ||
|
|
||
| struct Q { | ||
| ~Q() NOTHROW; | ||
| }; | ||
|
|
||
| struct R { | ||
| ~R() NOTHROW; | ||
| }; | ||
|
|
||
| struct S { | ||
| ~S() NOTHROW; | ||
| }; | ||
|
|
||
| const S& f() { | ||
| Q q; | ||
| return (R(), S()); | ||
| } | ||
|
|
||
| } // namespace dr650 | ||
|
|
||
| // CHECK-LABEL: define {{.*}} @dr650::f()() | ||
| // CHECK: call void @dr650::S::~S() | ||
| // CHECK: call void @dr650::R::~R() | ||
| // CHECK: call void @dr650::Q::~Q() | ||
| // CHECK-LABEL: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| namespace dr653 { // dr653: 2.7 | ||
|
|
||
| union U { | ||
| int a; | ||
| float b; | ||
| }; | ||
|
|
||
| void f(U u) { | ||
| U v; | ||
| v = u; | ||
| } | ||
|
|
||
| } // namespace dr653 | ||
|
|
||
| // CHECK-LABEL: define {{.*}} void @dr653::f(dr653::U) | ||
| // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}} %v, ptr {{.*}} %u, {{.*}}) | ||
| // CHECK-LABEL: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| namespace dr658 { // dr658: 2.7 | ||
|
|
||
| void f(int* p1) { | ||
| char* p2 = reinterpret_cast<char*>(p1); | ||
| } | ||
|
|
||
| } // namespace dr658 | ||
|
|
||
| // We're checking that p1 is stored into p2 without changes. | ||
|
|
||
| // CHECK-LABEL: define {{.*}} void @dr658::f(int*)(ptr noundef %p1) | ||
| // CHECK: [[P1_ADDR:%.+]] = alloca ptr, align 8 | ||
| // CHECK-NEXT: [[P2:%.+]] = alloca ptr, align 8 | ||
| // CHECK: store ptr %p1, ptr [[P1_ADDR]] | ||
| // CHECK-NEXT: [[TEMP:%.+]] = load ptr, ptr [[P1_ADDR]] | ||
| // CHECK-NEXT: store ptr [[TEMP]], ptr [[P2]] | ||
| // CHECK-LABEL: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| namespace dr661 { | ||
|
|
||
| void f(int a, int b) { // dr661: 2.7 | ||
| a == b; | ||
| a != b; | ||
| a < b; | ||
| a <= b; | ||
| a > b; | ||
| a >= b; | ||
| } | ||
|
|
||
| } // namespace dr661 | ||
|
|
||
| // CHECK-LABEL: define {{.*}} void @dr661::f(int, int) | ||
| // CHECK: icmp eq | ||
| // CHECK: icmp ne | ||
| // CHECK: icmp slt | ||
| // CHECK: icmp sle | ||
| // CHECK: icmp sgt | ||
| // CHECK: icmp sge | ||
| // CHECK-LABEL: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
| // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK | ||
|
|
||
| #if __cplusplus == 199711L | ||
| #define NOTHROW throw() | ||
| #else | ||
| #define NOTHROW noexcept(true) | ||
| #endif | ||
|
|
||
| namespace dr672 { // dr672: 2.7 | ||
|
|
||
| struct A { | ||
| A() NOTHROW; | ||
| }; | ||
|
|
||
| void f() { | ||
| A *a = new A; | ||
| } | ||
|
|
||
| } // namespace dr672 | ||
|
|
||
| // CHECK-LABEL: define {{.*}} void @dr672::f()() | ||
| // CHECK: [[A:%.+]] = alloca ptr | ||
| // CHECK: [[CALL:%.+]] = call {{.*}} ptr @operator new(unsigned long) | ||
| // CHECK: call void @dr672::A::A() | ||
| // CHECK: store ptr [[CALL]], ptr [[A]] | ||
| // CHECK-LABEL: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // RUN: %clang -fsanitize=implicit-bitfield-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION | ||
| // RUN: %clang -fsanitize=implicit-integer-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK | ||
| // RUN: %clang -fsanitize=implicit-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION | ||
|
|
||
| typedef struct _xx { | ||
| int x1:3; | ||
| char x2:2; | ||
| } xx, *pxx; | ||
|
|
||
| xx vxx; | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @foo1 | ||
| void foo1(int x) { | ||
| vxx.x1 = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @foo2 | ||
| void foo2(int x) { | ||
| vxx.x2 = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 6 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 6 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @foo3 | ||
| void foo3() { | ||
| vxx.x1++; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @foo4 | ||
| void foo4(int x) { | ||
| vxx.x1 += x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| // RUN: %clang -x c++ -fsanitize=implicit-bitfield-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION | ||
| // RUN: %clang -x c++ -fsanitize=implicit-integer-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK | ||
| // RUN: %clang -x c++ -fsanitize=implicit-conversion -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-BITFIELD-CONVERSION | ||
|
|
||
| struct S { | ||
| int a:3; | ||
| char b:2; | ||
| }; | ||
|
|
||
| class C : public S { | ||
| public: | ||
| short c:3; | ||
| }; | ||
|
|
||
| S s; | ||
| C c; | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @{{.*foo1.*}} | ||
| void foo1(int x) { | ||
| s.a = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-BITFIELD-CONVERSION: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| c.a = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-BITFIELD-CONVERSION: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @{{.*foo2.*}} | ||
| void foo2(int x) { | ||
| s.b = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-BITFIELD-CONVERSION: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 6 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 6 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| c.b = x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-BITFIELD-CONVERSION: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 6 | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 6 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @{{.*foo3.*}} | ||
| void foo3() { | ||
| s.a++; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| c.a++; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } | ||
|
|
||
| // CHECK-LABEL: define{{.*}} void @{{.*foo4.*}} | ||
| void foo4(int x) { | ||
| s.a += x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| c.a += x; | ||
| // CHECK: store i8 %{{.*}} | ||
| // CHECK-NEXT: [[BFRESULTSHL:%.*]] = shl i8 {{.*}}, 5 | ||
| // CHECK-NEXT: [[BFRESULTASHR:%.*]] = ashr i8 [[BFRESULTSHL]], 5 | ||
| // CHECK-NEXT: [[BFRESULTCAST:%.*]] = sext i8 [[BFRESULTASHR]] to i32 | ||
| // CHECK-BITFIELD-CONVERSION: call void @__ubsan_handle_implicit_conversion | ||
| // CHECK-BITFIELD-CONVERSION-NEXT: br label %[[CONT:.*]], !nosanitize !6 | ||
| // CHECK-BITFIELD-CONVERSION: [[CONT]]: | ||
| // CHECK-NEXT: ret void | ||
| } |