PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr67037.c
blob3119d327b02aa275114d8b33b342ccd73893e87e
1 long (*extfunc)();
3 static inline void lstrcpynW( short *d, const short *s, int n )
5 unsigned int count = n;
7 while ((count > 1) && *s)
9 count--;
10 *d++ = *s++;
12 if (count) *d = 0;
15 int __attribute__((noinline,noclone))
16 badfunc(int u0, int u1, int u2, int u3,
17 short *fsname, unsigned int fsname_len)
19 static const short ntfsW[] = {'N','T','F','S',0};
20 char superblock[2048+3300];
21 int ret = 0;
22 short *p;
24 if (extfunc())
25 return 0;
26 p = (void *)extfunc();
27 if (p != 0)
28 goto done;
30 extfunc(superblock);
32 lstrcpynW(fsname, ntfsW, fsname_len);
34 ret = 1;
35 done:
36 return ret;
39 static long f()
41 return 0;
44 int main()
46 short buf[6];
47 extfunc = f;
48 return !badfunc(0, 0, 0, 0, buf, 6);