mirror of
https://github.com/oasislinux/oasis.git
synced 2026-05-12 21:34:47 +02:00
51 lines
1.1 KiB
Diff
51 lines
1.1 KiB
Diff
From bccbc4107f6b3ad8fc14ad5409e46aa6ba933785 Mon Sep 17 00:00:00 2001
|
|
From: Michael Forney <mforney@mforney.org>
|
|
Date: Mon, 28 Apr 2025 22:44:49 -0700
|
|
Subject: [PATCH] Fix aliasing violation
|
|
|
|
---
|
|
emit.c | 14 +++++++-------
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/emit.c b/emit.c
|
|
index 4bd67d1..672af89 100644
|
|
--- a/emit.c
|
|
+++ b/emit.c
|
|
@@ -159,7 +159,7 @@ emitfin(FILE *f, char *sec[3])
|
|
{
|
|
Asmbits *b;
|
|
int lg, i;
|
|
- union { int32_t i; float f; } u;
|
|
+ union { int32_t i32; float f32; int64_t i64; double f64; } u;
|
|
|
|
if (!stash)
|
|
return;
|
|
@@ -178,18 +178,18 @@ 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) {
|
|
+ u.i64 = b->n;
|
|
fprintf(f,
|
|
"\n\t.quad %"PRId64
|
|
" /* %f */\n\n",
|
|
- (int64_t)b->n,
|
|
- *(double *)&b->n);
|
|
- else if (lg == 2) {
|
|
- u.i = b->n;
|
|
+ u.i64, u.f64);
|
|
+ } else if (lg == 2) {
|
|
+ u.i32 = b->n;
|
|
fprintf(f,
|
|
"\n\t.int %"PRId32
|
|
" /* %f */\n\n",
|
|
- u.i, (double)u.f);
|
|
+ u.i32, u.f32);
|
|
}
|
|
}
|
|
}
|
|
--
|
|
2.49.0
|
|
|