aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/bounds-checking-fam.cpp
blob: 90581f3620df7bb833144570039159050eae4169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fsanitize=array-bounds %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0
//
// Disable checks on FAM even though the class doesn't have standard layout.

struct C {
  int head;
};

struct S : C {
  int tail[1];
};

// CHECK-LABEL: define {{.*}} @_Z8test_oneP1Si(
int test_one(S *p, int i) {
  // CHECK-STRICT-0-NOT: @__ubsan
  return p->tail[i] + (p->tail)[i];
}