]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.c-torture/execute/20190820-1.c
1 /* PR rtl-optimization/91347 */
2 /* Reported by John David Anglin <danglin@gcc.gnu.org> */
4 typedef unsigned short __u16
;
5 typedef __signed__
int __s32
;
6 typedef unsigned int __u32
;
7 typedef __signed__
long long __s64
;
8 typedef unsigned long long __u64
;
18 char hex_asc_upper
[16];
21 static __attribute__ ((noipa
)) void
22 put_dec_full4 (char *buf
, unsigned r
)
25 q
= (r
* 0x147b) >> 19;
26 *((u16
*)buf
) = decpair
[r
- 100*q
];
28 *((u16
*)buf
) = decpair
[q
];
31 static __attribute__ ((noipa
)) unsigned
32 put_dec_helper4 (char *buf
, unsigned x
)
34 uint32_t q
= (x
* (uint64_t)0x346DC5D7) >> 43;
35 put_dec_full4(buf
, x
- q
* 10000);
39 static __attribute__ ((noipa
)) char *
40 put_dec (char *buf
, unsigned long long n
)
42 uint32_t d3
, d2
, d1
, q
, h
;
43 d1
= ((uint32_t)n
>> 16);
47 q
= 656 * d3
+ 7296 * d2
+ 5536 * d1
+ ((uint32_t)n
& 0xffff);
48 q
= put_dec_helper4(buf
, q
);
49 q
+= 7671 * d3
+ 9496 * d2
+ 6 * d1
;
50 q
= put_dec_helper4(buf
+4, q
);
51 q
+= 4749 * d3
+ 42 * d2
;
52 q
= put_dec_helper4(buf
+8, q
);
58 signed int field_width
:24;
61 signed int precision
:16;
62 } __attribute__((__packed__
));
64 static __attribute__ ((noipa
)) char *
65 number (char *buf
, char *end
, unsigned long long num
, struct printf_spec spec
)
68 char tmp
[3 * sizeof(num
)] __attribute__((__aligned__(2)));
71 int need_pfx
= ((spec
.flags
& 64) && spec
.base
!= 10);
73 bool is_zero
= num
== 0LL;
74 int field_width
= spec
.field_width
;
75 int precision
= spec
.precision
;
79 tmp
[i
++] = hex_asc_upper
[num
] | locase
;
80 else if (spec
.base
!= 10) {
81 int mask
= spec
.base
- 1;
88 tmp
[i
++] = (hex_asc_upper
[((unsigned char)num
) & mask
] | locase
);
92 i
= put_dec(tmp
, num
) - tmp
;
97 static __attribute__ ((noipa
)) char *
98 pointer_string (char *buf
, char *end
, const void *ptr
, struct printf_spec spec
)
102 return number(buf
, end
, 100, spec
);
108 struct printf_spec spec
;
109 char *s
= pointer_string (0, 0, 0, spec
);