xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/gcc.c-torture/compile/930120-1.c (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 union {
2   short I[2];
3   long int L;
4   char C[4];
5 } itolws;
6 char *errflg;
7 long int dot;
8 short dotinc;
9 long int expvf;
10 
11 char *
12 f(fcount,ifp,itype,ptype)
13      short fcount;
14      char *ifp;
15 {
16   unsigned w;
17   long int savdot, wx;
18   char *fp;
19   char c, modifier, longpr;
20   union {
21     double dval;
22     struct {
23       int i1;
24       int i2;
25     } ival;
26   } dw;
27   union {
28     float fval;
29     int ival;
30   } fw;
31   int gotdot = 0;
32   while (fcount > 0) {
33     fp = ifp;
34     c = *fp;
35     longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i'));
36     if ((itype == 0) || (*fp == 'a')) {
37       wx = dot;
38       w = dot;
39     } else {
40       gotdot = 1;
41       wx = get((int)dot, itype);
42       if (!longpr) {
43 	w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]);
44       }
45     }
46     if (c == 'F') {
47       dw.ival.i1 = wx;
48       if (itype == 0) {
49 	dw.ival.i2 = expvf;
50       }
51     }
52 
53     modifier = *fp++;
54     switch(modifier) {
55     case ' ' :
56     case '\t' :
57       break;
58     case 't':
59     case 'T':
60       printf("%T",fcount);
61       return(fp);
62     case 'r':
63     case 'R':
64       printf("%M",fcount);
65       return(fp);
66     case 'k':
67       printf("%k",w);
68       break;
69     case 'K':
70       printf("%K",wx);
71       break;
72     case 'a':
73       psymoff(dot,ptype,":%16t");
74       dotinc = 0;
75       break;
76     case 'p':
77       psymoff(0,ptype,"%16t");
78       break;
79     case 'u':
80       printf("%-8u",w);
81       break;
82     case 'U':
83       printf("%-16U",wx); break;
84     case 'c':
85     case 'C':
86       if (modifier == 'C') {
87 	printesc((int)(itolws.L=(wx), itolws.C[(dot)&3]));
88       } else {
89 	printc((char)(itolws.L=(wx), itolws.C[(dot)&3]));
90       }
91       dotinc = 1;
92       break;
93     case 'b':
94       printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3]));
95       dotinc = 1;
96       break;
97     case 'B':
98       printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3]));
99       dotinc = 1;
100       break;
101     case 's':
102     case 'S':
103       savdot = dot;
104       dotinc = 1;
105       while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) {
106 	dot = inkdot(1);
107 	if (modifier == 'S') {
108 	  printesc(c);
109 	} else {
110 	  printc(c);
111 	}
112 	endline();
113 	if (!(dot & 3))
114 	  wx = get((int)dot, itype);
115       }
116       dotinc = dot - savdot + 1;
117       dot = savdot;
118       break;
119     case 'i':
120       if (gotdot) {
121 	wx = get((int)(dot & ~3), itype);
122       }
123       iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3));
124       printc('\n');
125       break;
126     case 'f':
127       fw.ival = wx;
128       printf("%-16.9f", fw.fval);
129       dotinc = 4;
130       break;
131     case 'F':
132       printf("%-32.18F", dw.dval);
133       dotinc = 8;
134       break;
135     }
136   }
137   return(fp);
138 }
139