clang/test/CodeGen/bounds-checking-fam.cpp
raw| 1 | // REQUIRES: x86-registered-target |
| 2 | // RUN: %clang_cc1 -emit-llvm -triple x86_64 -fsanitize=array-bounds %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0 |
| 3 | // |
| 4 | // Disable checks on FAM even though the class doesn't have standard layout. |
| 5 | |
| 6 | struct C { |
| 7 | int head; |
| 8 | }; |
| 9 | |
| 10 | struct S : C { |
| 11 | int tail[1]; |
| 12 | }; |
| 13 | |
| 14 | // CHECK-LABEL: define {{.*}} @_Z8test_oneP1Si( |
| 15 | int test_one(S *p, int i) { |
| 16 | // CHECK-STRICT-0-NOT: @__ubsan |
| 17 | return p->tail[i] + (p->tail)[i]; |
| 18 | } |