<commit_before>// RUN: %clangxx -fsanitize=bounds %s -O3 -o %t
// RUN: %run %t 0 0 0
// RUN: %run %t 1 2 3
// RUN: %expect_crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2
// RUN: %run %t 0 3 0 2>&1 | FileCheck %s --check-prefix=CHECK-B-3
// RUN: %run %t 0 0 4 2>&1 | FileCheck %s --check-prefix=CHECK-C-4

int main(int argc, char **argv) {
  int arr[2][3][4] = {};
<commit_msg>[ubsan] Test for pass_object_size bounds checks<commit_after>// RUN: %clangxx -fsanitize=bounds %s -O3 -o %t
// RUN: %run %t 0 0 0
// RUN: %run %t 1 2 3
// RUN: %expect_crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2
// RUN: %run %t 0 3 0 2>&1 | FileCheck %s --check-prefix=CHECK-B-3
// RUN: %run %t 0 0 4 2>&1 | FileCheck %s --check-prefix=CHECK-C-4

int get_int(int *const p __attribute__((pass_object_size(0))), int i) {
  // CHECK-A-2: bounds.cpp:[[@LINE+1]]:10: runtime error: index 2 out of bounds for type 'int *'
  return p[i];
}

int get_double(double *const p __attribute__((pass_object_size(0))), int i) {
  // CHECK-A-2: bounds.cpp:[[@LINE+1]]:10: runtime error: index 2 out of bounds for type 'double *'
  return p[i];
}

int main(int argc, char **argv) {
  int bar[2];
  get_int(bar, argv[1][0] - '0');

  double baz[2];
  get_double(baz, argv[1][0] - '0');

  int arr[2][3][4] = {};

{'fraction_non_alphanumeric': 0.2047364400305577, 'fraction_numerical': 0.058059587471352175, 'mean_word_length': 3.3092105263157894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6943494', 'n_tokens_mistral': 607, 'n_tokens_neox': 550, 'n_words': 173}