Debian Codegraph @

gcc/testsuite/c-c++-common/asan/pr71480.c

raw
1 /* { dg-do run } */
2
3 __attribute__ ((noinline, noclone)) int
4 foo (char *c)
5 {
6 asm volatile ("" : : "r" (c) : "memory");
7 return 1;
8 }
9
10 __attribute__ ((noinline, noclone)) void
11 bar (char *c)
12 {
13 asm volatile ("" : : "r" (c) : "memory");
14 }
15
16 int main ()
17 {
18 char tpl[20] = "/tmp/test.XXXXXX";
19 char tpl2[20] = "/tmp/test.XXXXXX";
20 int fd = foo (tpl);
21 int fd2 = foo (tpl2);
22 if (fd == -1)
23 {
24 if (fd2 != -1)
25 bar (tpl2);
26 return 1;
27 }
28
29 if (fd2 == -1)
30 return 1;
31
32 bar (tpl);
33 bar (tpl2);
34
35 if (__builtin_strcmp (tpl, "/tmp/test.XXXXXX") != 0)
36 return 1;
37
38 if (__builtin_strcmp (tpl, tpl2) != 0)
39 return 1;
40
41 return 0;
42 }