Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari/stand/installboot Appease gcc48 -Werror=stric...



details:   https://anonhg.NetBSD.org/src/rev/715537538496
branches:  trunk
changeset: 803922:715537538496
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Nov 16 13:47:52 2014 +0000

description:
Appease gcc48 -Werror=strict-aliasing warning by filling cksum via union.

Discussed in source-changes-d@ thread and tested on TT030.
Should be pulled up to netbsd-7 (if NetBSD/m68k 7.0 will switch to gcc48).

diffstat:

 sys/arch/atari/stand/installboot/installboot.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r d09c270a5260 -r 715537538496 sys/arch/atari/stand/installboot/installboot.c
--- a/sys/arch/atari/stand/installboot/installboot.c    Sun Nov 16 13:38:39 2014 +0000
+++ b/sys/arch/atari/stand/installboot/installboot.c    Sun Nov 16 13:47:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: installboot.c,v 1.31 2014/11/16 13:38:39 tsutsui Exp $ */
+/*     $NetBSD: installboot.c,v 1.32 2014/11/16 13:47:52 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -467,6 +467,10 @@
     struct disklabel *label, u_int magic)
 {
        int              fd;
+       union {
+               struct bootblock *bbp;
+               uint16_t *word;         /* to fill cksum word */
+       } bbsec;
 
        memset(bb, 0, sizeof(*bb));
 
@@ -498,8 +502,9 @@
        setIDEpar(bb->bb_xxboot, sizeof(bb->bb_xxboot));
 
        /* set AHDI checksum */
-       *((u_int16_t *)bb->bb_xxboot + 255) = 0;
-       *((u_int16_t *)bb->bb_xxboot + 255) = 0x1234 - abcksum(bb->bb_xxboot);
+       bbsec.bbp = bb;
+       bbsec.word[255] = 0;
+       bbsec.word[255] = 0x1234 - abcksum(bb->bb_xxboot);
 
        if (verbose) {
                printf("Primary   boot loader: %s\n", xxb);



Home | Main Index | Thread Index | Old Index