mirror of
git://c9x.me/qbe.git
synced 2026-08-02 15:44:39 +00:00
emit: fix aliasing-breaking pointer dereference via union
emit.c:186:50: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Bug: https://bugs.gentoo.org/976975
This commit is contained in:
parent
c0818978ac
commit
fa19d3c974
9
emit.c
9
emit.c
@ -160,6 +160,7 @@ emitfin(FILE *f, char *sec[3])
|
||||
Asmbits *b;
|
||||
int lg, i;
|
||||
union { int32_t i; float f; } u;
|
||||
union { int64_t i; double f; } uu;
|
||||
|
||||
if (!stash)
|
||||
return;
|
||||
@ -178,13 +179,13 @@ emitfin(FILE *f, char *sec[3])
|
||||
"\n\t.quad %"PRId64
|
||||
"\n\t.quad 0\n\n",
|
||||
(int64_t)b->n);
|
||||
else if (lg == 3)
|
||||
else if (lg == 3) {
|
||||
uu.i = b->n;
|
||||
fprintf(f,
|
||||
"\n\t.quad %"PRId64
|
||||
" /* %f */\n\n",
|
||||
(int64_t)b->n,
|
||||
*(double *)&b->n);
|
||||
else if (lg == 2) {
|
||||
uu.i, uu.f);
|
||||
} else if (lg == 2) {
|
||||
u.i = b->n;
|
||||
fprintf(f,
|
||||
"\n\t.int %"PRId32
|
||||
|
||||
Loading…
Reference in New Issue
Block a user