3 /* Testcase distilled from glibc's nss_parse_service_list in nss/nsswitch.c
4 It can't be distilled further. Fails with `-O2' for i[3456]86. */
6 /* this simulates a bounded-pointer type. */
7 struct ucharp
{ unsigned char *v
, *l
, *h
; };
9 /* this simulates bounded-pointer check prior to pointer dereference. */
10 #define AREF(var, idx) ((((((((var).v+(idx)) < (var).l) \
11 || (((var).v+(idx)+1) > (var).h))) \
12 && (__builtin_trap (), 0)), \
30 foo (struct ucharp cp
, struct ucharp lp
, struct list
**nextp
)
35 while (AREF (lp
, 0) && AREF (cp
, AREF (lp
, 0)))
38 while (AREF (cp
, AREF (lp
, 0)))
40 if (AREF (lp
, 0) == one
)
43 while (AREF (lp
, 0) && AREF (cp
, AREF (lp
, 0)));
44 /* The above AREF (cp, ...) fails because the pseudo created to
45 hold cp.v holds garbage, having never been set.
46 The easiest way to see the problem is to compile wiht `-O2 -da'
47 then look at *.09.loop. Search for something like this:
49 Hoisted regno 183 r/o from (mem/s:SI (reg:SI 16 argp) 10)
50 Replaced reg 91, deleting init_insn (213).
52 Now, look for the use of reg 91, which has no set. */
61 extern void exit (int);
66 static unsigned char cp0
[] = "\0\0\0\0";
67 struct ucharp cp
= { cp0
, cp0
, cp0
+ sizeof (cp0
) };
69 static unsigned char lp0
[] = "\1\1\0\0";
70 struct ucharp lp
= { lp0
, lp0
, lp0
+ sizeof (lp0
) };
73 struct list
*nextp
= &list
;