2020-04-01 04:45:22 +00:00
|
|
|
void printf (string fmt, ...) = #0;
|
|
|
|
# define M_PI 3.14159265358979323846
|
|
|
|
|
|
|
|
union {
|
|
|
|
double d;
|
|
|
|
int i[2];
|
|
|
|
} type_pun;
|
|
|
|
|
|
|
|
int alias_printf (string fmt, ...);
|
|
|
|
|
|
|
|
int
|
|
|
|
test_alias ()
|
|
|
|
{
|
|
|
|
int fail = 0;
|
|
|
|
type_pun.d = M_PI;
|
|
|
|
fail = alias_printf ("%g %08x%08x\n", type_pun.d,
|
|
|
|
type_pun.i[1], type_pun.i[0]);
|
|
|
|
return fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
alias_printf (string fmt, ...)
|
|
|
|
{
|
|
|
|
int fail = 0;
|
|
|
|
// this will fail on big-endian systems
|
2022-01-18 04:21:06 +00:00
|
|
|
fail = (@args.list[2].int_val != 0x54442d18
|
|
|
|
|| @args.list[1].int_val != 0x400921fb);
|
2020-04-01 04:45:22 +00:00
|
|
|
printf ("%g %08x%08x\n",
|
2022-01-18 04:21:06 +00:00
|
|
|
@args.list[0].int_val,
|
|
|
|
@args.list[2].int_val,
|
|
|
|
@args.list[1].int_val);
|
2020-04-01 04:45:22 +00:00
|
|
|
return fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main ()
|
|
|
|
{
|
|
|
|
int fail = 0;
|
|
|
|
fail |= test_alias ();
|
|
|
|
return fail;
|
|
|
|
}
|