1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* Sched1 moved {load_tp} pattern between strlen call and the copy
4 of the hard return value to its pseudo. This resulted in a
5 reload abort, since the hard register was not spillable. */
7 extern __thread int __libc_errno __attribute__ ((tls_model ("initial-exec")));
13 typedef __SIZE_TYPE__ size_t;
14 typedef unsigned long long uint64_t;
17 extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
18 extern int strcmp (__const char *__s1, __const char *__s2)
19 __attribute__ ((__pure__));
21 extern int __open64 (__const char *__file, int __oflag, ...);
22 extern int __open (__const char *__file, int __oflag, ...);
23 extern int __mkdir (__const char *__path, __mode_t __mode);
24 extern int __lxstat64 (int __ver, __const char *__filename,
25 struct stat64 *__stat_buf) ;
27 static const char letters[] =
28 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
31 __gen_tempname (char *tmpl, int kind)
35 static uint64_t value;
36 uint64_t random_time_bits;
39 int save_errno = __libc_errno;
41 unsigned int attempts_min = 62 * 62 * 62;
42 unsigned int attempts = attempts_min < 238328 ? 238328 : attempts_min;
45 if (len < 6 || strcmp(&tmpl[len - 6], "XXXXXX"))
47 (__libc_errno = (22));
51 XXXXXX = &tmpl[len - 6];
53 for (count = 0; count < attempts; value += 7777, ++count)
57 XXXXXX[0] = letters[v % 62];
59 XXXXXX[1] = letters[v % 62];
61 XXXXXX[2] = letters[v % 62];
63 XXXXXX[3] = letters[v % 62];
65 XXXXXX[4] = letters[v % 62];
67 XXXXXX[5] = letters[v % 62];
72 fd = __open (tmpl, 02 | 01000 | 04000, 0400 | 0200);
76 fd = __open64 (tmpl, 02 | 01000 | 04000, 0400 | 0200);
80 fd = __mkdir (tmpl, 0400 | 0200 | 0100);
84 if (__lxstat64 (2, tmpl, &st) < 0)
86 if (__libc_errno == 2)
88 (__libc_errno = (save_errno));
100 (__libc_errno = (save_errno));
103 else if (__libc_errno != 17)
107 (__libc_errno = (17));