annotate compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp @ 231:5f20bc1ed4ff

orignal merge with github
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 21 Jul 2021 10:21:57 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
231
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && %run %t
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 //
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // Not expected to work yet with HWAsan.
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // XFAIL: *
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #include <stdio.h>
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #include <stdlib.h>
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 int *p[3];
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 int main() {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // Variable goes in and out of scope.
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 for (int i = 0; i < 3; i++) {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 int x;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 p[i] = &x;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 printf("PASSED\n");
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 return 0;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 }