opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

0001-Fix-aliasing-violation.patch (1137B)


      1 From 70d0e4d5052565eb7124d00542249c0059c26378 Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Mon, 28 Apr 2025 22:44:49 -0700
      4 Subject: [PATCH] Fix aliasing violation
      5 
      6 ---
      7  emit.c | 14 +++++++-------
      8  1 file changed, 7 insertions(+), 7 deletions(-)
      9 
     10 diff --git a/emit.c b/emit.c
     11 index 04837a5..19fd56d 100644
     12 --- a/emit.c
     13 +++ b/emit.c
     14 @@ -155,7 +155,7 @@ emitfin(FILE *f, char *sec[3])
     15  {
     16  	Asmbits *b;
     17  	int lg, i;
     18 -	union { int32_t i; float f; } u;
     19 +	union { int32_t i32; float f32; int64_t i64; double f64; } u;
     20  
     21  	if (!stash)
     22  		return;
     23 @@ -174,18 +174,18 @@ emitfin(FILE *f, char *sec[3])
     24  						"\n\t.quad %"PRId64
     25  						"\n\t.quad 0\n\n",
     26  						(int64_t)b->n);
     27 -				else if (lg == 3)
     28 +				else if (lg == 3) {
     29 +					u.i64 = b->n;
     30  					fprintf(f,
     31  						"\n\t.quad %"PRId64
     32  						" /* %f */\n\n",
     33 -						(int64_t)b->n,
     34 -						*(double *)&b->n);
     35 -				else if (lg == 2) {
     36 -					u.i = b->n;
     37 +						u.i64, u.f64);
     38 +				} else if (lg == 2) {
     39 +					u.i32 = b->n;
     40  					fprintf(f,
     41  						"\n\t.int %"PRId32
     42  						" /* %f */\n\n",
     43 -						u.i, (double)u.f);
     44 +						u.i32, u.f32);
     45  				}
     46  			}
     47  		}
     48 -- 
     49 2.45.2
     50