Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr67037.c

raw
1 /* { dg-additional-options "-std=gnu17" } */
2
3 long (*extfunc)();
4
5 static inline void lstrcpynW( short *d, const short *s, int n )
6 {
7 unsigned int count = n;
8
9 while ((count > 1) && *s)
10 {
11 count--;
12 *d++ = *s++;
13 }
14 if (count) *d = 0;
15 }
16
17 int __attribute__((noinline,noclone))
18 badfunc(int u0, int u1, int u2, int u3,
19 short *fsname, unsigned int fsname_len)
20 {
21 static const short ntfsW[] = {'N','T','F','S',0};
22 char superblock[2048+3300];
23 int ret = 0;
24 short *p;
25
26 if (extfunc())
27 return 0;
28 p = (void *)extfunc();
29 if (p != 0)
30 goto done;
31
32 extfunc(superblock);
33
34 lstrcpynW(fsname, ntfsW, fsname_len);
35
36 ret = 1;
37 done:
38 return ret;
39 }
40
41 static long f()
42 {
43 return 0;
44 }
45
46 int main()
47 {
48 short buf[6];
49 extfunc = f;
50 return !badfunc(0, 0, 0, 0, buf, 6);
51 }