# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by scripts/Create-CopyPatch. # # T2 SDE: package/.../netkit-base/64bit-alignment.patch # Copyright (C) 2004 - 2020 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- At least on sparc64 gcc optimized the memcpy into 2 32bit load/stores. However the data does not match that alignment requirements, the program receivees a SIGBUS. I'm not sure if this is a misoptimization bug in gcc ... - Rene Rebe diff -ur netkit-base-0.17/ping/ping.c netkit-base-0.17-fixed/ping/ping.c --- netkit-base-0.17/ping/ping.c 2000-07-23 06:16:21.000000000 +0200 +++ netkit-base-0.17-fixed/ping/ping.c 2005-01-29 17:53:55.000000000 +0100 @@ -673,7 +673,7 @@ { struct ip *ip; struct icmp *icp; - struct timeval now, packettv, *tp; + struct timeval now, packettv; long triptime = 0; int hlen, dupflag; int rv; @@ -722,8 +722,7 @@ return 0; /* 'Twas not our ECHO */ nreceived++; if (timing) { - tp = (struct timeval *)icp->icmp_data; - memcpy(&packettv, tp, sizeof(struct timeval)); + memcpy(&packettv, icp->icmp_data, sizeof(struct timeval)); tvsub(&now, &packettv); /* precision: tenths of milliseconds */