1 /* { dg-options "-O2 -mcmodel=small -fPIC -fno-builtin" }  */
2 /* { dg-do compile } */
3 
4 typedef long unsigned int size_t;
5 enum
6 {
7   __LC_TIME = 2,
8 };
9 enum
10 {
11   ABDAY_1 = (((__LC_TIME) << 16) | (0)),
12   DAY_1,
13   ABMON_1,
14   MON_1,
15   D_T_FMT,
16 };
17 typedef struct __locale_struct
18 {
19   struct locale_data *__locales[13];
20 } *__locale_t;
21 struct tm
22 {
23   int tm_sec;
24   int tm_min;
25   int tm_hour;
26 };
27 struct locale_data
28 {
29   const char *name;
30   struct
31   {
32     const char *string;
33   }
34   values [];
35 };
36 extern const struct locale_data _nl_C_LC_TIME __attribute__ ((visibility ("hidden")));
37 char *
__strptime_internal(rp,fmt,tmp,statep,locale)38 __strptime_internal (rp, fmt, tmp, statep , locale)
39      const char *rp;
40      const char *fmt;
41      __locale_t locale;
42      void *statep;
43 {
44   struct locale_data *const current = locale->__locales[__LC_TIME];
45   const char *rp_backup;
46   const char *rp_longest;
47   int cnt;
48   size_t val;
49   enum ptime_locale_status { not, loc, raw } decided_longest;
50   struct __strptime_state
51   {
52     enum ptime_locale_status decided : 2;
53   } s;
54   struct tm tmb;
55   struct tm *tm;
56   if (statep == ((void *)0))
57     {
58       memset (&s, 0, sizeof (s));
59     }
60     {
61       tm = &tmb;
62     }
63   while (*fmt != '\0')
64     {
65       if (*fmt != '%')
66  {
67    if (*fmt++ != *rp++) return ((void *)0);
68    continue;
69  }
70       if (statep != ((void *)0))
71  {
72      ++fmt;
73  }
74       rp_backup = rp;
75       switch (*fmt++)
76  {
77  case '%':
78    for (cnt = 0; cnt < 7; ++cnt)
79      {
80        const char *trp;
81        if (s.decided !=raw)
82   {
83     if (({ size_t len = strlen ((current->values[((int) (DAY_1 + cnt) & 0xffff)].string)); int result = __strncasecmp_l (((current->values[((int) (DAY_1 + cnt) & 0xffff)].string)), (trp), len, locale) == 0; if (result) (trp) += len; result; })
84         && trp > rp_longest)
85       {
86       }
87     if (({ size_t len = strlen ((current->values[((int) (ABDAY_1 + cnt) & 0xffff)].string)); int result = __strncasecmp_l (((current->values[((int) (ABDAY_1 + cnt) & 0xffff)].string)), (trp), len, locale) == 0; if (result) (trp) += len; result; })
88         && trp > rp_longest)
89       {
90       }
91   }
92        if (s.decided != loc
93     && (((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (DAY_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (DAY_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
94          && trp > rp_longest)
95         || ((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (ABDAY_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (ABDAY_1) & 0xffff)].string)[cnt]), (rp), len, locale) == 0; if (result) (rp) += len; result; }))
96      && trp > rp_longest)))
97   {
98   }
99      }
100      {
101        const char *trp;
102        if (s.decided != loc
103     && (((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (MON_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (MON_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
104          && trp > rp_longest)
105         || ((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (ABMON_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (ABMON_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
106      && trp > rp_longest)))
107   {
108   }
109      }
110  case 'c':
111      {
112        if (!(*((current->values[((int) (D_T_FMT) & 0xffff)].string)) != '\0' && (rp = __strptime_internal (rp, ((current->values[((int) (D_T_FMT) & 0xffff)].string)), tm, &s , locale)) != ((void *)0)))
113   {
114       rp = rp_backup;
115   }
116      }
117  case 'C':
118    do { int __n = 2; val = 0; while (*rp == ' ') ++rp; if (*rp < '0' || *rp > '9') return ((void *)0); do { val *= 10; val += *rp++ - '0'; } while (--__n > 0 && val * 10 <= 99 && *rp >= '0' && *rp <= '9'); if (val < 0 || val > 99) return ((void *)0); } while (0);
119  case 'F':
120    if (!(*("%Y-%m-%d") != '\0' && (rp = __strptime_internal (rp, ("%Y-%m-%d"), tm, &s , locale)) != ((void *)0)))
121    tm->tm_hour = val % 12;
122  }
123     }
124 }
125 char *
__strptime_l(buf,format,tm,locale)126 __strptime_l (buf, format, tm , locale)
127 {
128 }
129