:It's not a compiler bug, it's a source code bug.
:
:The C Language specifies that pointers to distinct types can be
:assumed, under certain conditions, never to alias one another. (This
:...
:Recent values of GCC make use of this obscure language feature to
:improve optimization. Essentially, the optimizer can assume that
:...
:-GAWollman
:
:--
:Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same
Someone try the patch below and tell me if it fixes the problem. If it
does then I'll commit it. If someone else wants to commit a 'better'
fix, be my guest! (but inform the list that you've done so). Otherwise
this is the one that will go in.
-Matt
Index: ping.c
===================================================================
RCS file: /home/ncvs/src/sbin/ping/ping.c,v
retrieving revision 1.45
diff -u -r1.45 ping.c
--- ping.c 1999/08/28 00:13:59 1.45
+++ ping.c 1999/11/15 19:26:23
@@ -920,6 +920,9 @@
/*
* in_cksum --
* Checksum routine for Internet Protocol family headers (C Version)
+ *
+ * note: volatilization of 'answer' is a bad hack to work around an
+ * aliasing problem.
*/
u_short
in_cksum(addr, len)
@@ -929,7 +932,7 @@
register int nleft = len;
register u_short *w = addr;
register int sum = 0;
- u_short answer = 0;
+ volatile u_short answer = 0;
/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message