brintos

brintos / llvm-project-archived public Read only

0
0
Text · 763 B · 4814cfb Raw
20 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,REGULAR2// RUN: %clang_cc1 -std=c++2a -fsanitize=shift-base,shift-exponent -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,SANITIZED3 4// CHECK-LABEL: @_Z12lsh_overflow5int lsh_overflow(int a, int b) {6  // SANITIZED: %[[RHS_INBOUNDS:.*]] = icmp ule i32 %[[RHS:.*]], 317  // SANITIZED-NEXT: br i1 %[[RHS_INBOUNDS]], label %[[VALID:.*]], label8 9  // SANITIZED: call void @__ubsan_handle_shift_out_of_bounds10 11  // No check for the LHS here.12  // SANITIZED: [[VALID]]:13  // SANITIZED-NEXT: shl i32 %14  // SANITIZED-NEXT: ret i3215 16  // Just ensure there's no nsw nuw flags here.17  // REGULAR: shl i32 %18  return a << b;19}20