Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/pcc/dist/pcc/arch/amd64 avoid strict aliasing p...



details:   https://anonhg.NetBSD.org/src/rev/7fb5da01450a
branches:  trunk
changeset: 783609:7fb5da01450a
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 31 18:47:41 2012 +0000

description:
avoid strict aliasing problems

diffstat:

 external/bsd/pcc/dist/pcc/arch/amd64/local.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (27 lines):

diff -r eb5b041bbcfe -r 7fb5da01450a external/bsd/pcc/dist/pcc/arch/amd64/local.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Mon Dec 31 16:20:17 2012 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Mon Dec 31 18:47:41 2012 +0000
@@ -1,5 +1,5 @@
 /*     Id: local.c,v 1.66 2012/03/23 17:03:09 ragge Exp        */      
-/*     $NetBSD: local.c,v 1.1.1.4 2012/03/26 14:26:17 plunky Exp $     */
+/*     $NetBSD: local.c,v 1.2 2012/12/31 18:47:41 christos Exp $       */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -540,10 +540,12 @@
 
 #ifdef mach_amd64
        {
-               /* Do not loose negative zeros */
-               long long *llp = (long long *)(&p->n_dcon);
-               short *ssp = (short *)&llp[1];
-               if (*llp == 0 && *ssp == 0)
+               /* Do not lose negative zeros */
+               long long ll[2];
+               short ss;
+               memcpy(ll, &p->n_dcon, sizeof(ll));
+               memcpy(&ss, &ll[1], sizeof(ss));
+               if (ll[0] == 0 && ss == 0)
                        return;
        }
 #else



Home | Main Index | Thread Index | Old Index