Merge branches/gcc-4_9-branch rev 225109.
[official-gcc.git] / gcc-4_9-branch / gcc / testsuite / gcc.target / powerpc / pr60158.c
blobe832397ddc218a4f38440dc3fb37b0b62de6d16d
1 /* { dg-do compile } */
2 /* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
3 /* { dg-options "-mcpu=8548 -mno-spe -mfloat-gprs=double -Os -fdata-sections -fpic -mrelocatable" } */
5 #define NULL 0
6 int func (int val);
7 void *func2 (void *ptr);
9 static const char *ifs;
10 static char map[256];
12 typedef struct {
13 /* None of these fields are used, but removing any
14 of them makes the problem go away. */
15 char *data;
16 int length;
17 int maxlen;
18 int quote;
19 } o_string;
21 #define NULL_O_STRING {NULL,0,0,0}
23 static int parse_stream (void *dest, void *ctx)
25 int ch = func (0), m;
27 while (ch != -1) {
28 m = map[ch];
29 if (ch != '\n')
30 func2(dest);
32 ctx = func2 (ctx);
33 if (!func (0))
34 return 0;
35 if (m != ch) {
36 func2 ("htns");
37 break;
40 return -1;
43 static void mapset (const char *set, int code)
45 const char *s;
46 for (s=set; *s; s++) map[(int)*s] = code;
49 static void update_ifs_map(void)
51 /* char *ifs and char map[256] are both globals. */
52 ifs = func2 ("abc");
53 if (ifs == NULL) ifs="def";
55 func2 (map);
57 char subst[2] = {4, 0};
58 mapset (subst, 3);
60 mapset (";&|#", 1);
63 int parse_stream_outer (int flag)
65 int blah;
66 o_string temp=NULL_O_STRING;
67 int rcode;
69 do {
70 update_ifs_map ();
71 func2 (&blah); /* a memory clobber works as well. */
72 rcode = parse_stream (&temp, NULL);
73 func2 ("aoeu");
74 if (func (0) != 0) {
75 func2 (NULL);
77 } while (rcode != -1);
78 return 0;
81 /* { dg-final { if ![file exists pr60158.s] { fail "pr60158.c (compile)"; return; } } } */
83 /* { dg-final { set c_rel [llength [grep pr60158.s \\.data\\.rel\\.ro\\.local]] } } */
84 /* { dg-final { set c_fix [llength [grep pr60158.s \\.fixup]] } } */
85 /* { dg-final { if [string match $c_rel $c_fix] \{ } } */
86 /* { dg-final { pass "pr60158.c (passed)" } } */
87 /* { dg-final { \} else \{ } } */
88 /* { dg-final { fail "pr60158.c (.fixup table entries not generated for .data.rel.ro.local section)" } } */
89 /* { dg-final { \} } } */