* [PATCH] sparc32: fix gcc over-optimizatoin near ip_fast_csum
@ 2007-01-14 20:32 Bob Breuer
2007-01-16 3:06 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Bob Breuer @ 2007-01-14 20:32 UTC (permalink / raw)
To: sparclinux
Fix over-optimization by GCC near ip_fast_csum.
In some cases such as:
iph->check = 0;
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
GCC may optimize out the previous store.
Observed as a failure of NFS over udp (bad checksums on ip fragments) when
compiled with GCC 3.4.2.
Signed-off-by: Bob Breuer <breuerr@mc.net>
---
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 267e631..34518ea 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -151,7 +151,7 @@ static inline __sum16 ip_fast_csum(const
"xnor\t%%g0, %0, %0"
: "=r" (sum), "=&r" (iph)
: "r" (ihl), "1" (iph)
- : "g2", "g3", "g4", "cc");
+ : "g2", "g3", "g4", "cc", "memory");
return sum;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sparc32: fix gcc over-optimizatoin near ip_fast_csum
2007-01-14 20:32 [PATCH] sparc32: fix gcc over-optimizatoin near ip_fast_csum Bob Breuer
@ 2007-01-16 3:06 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-01-16 3:06 UTC (permalink / raw)
To: sparclinux
From: Bob Breuer <breuerr@mc.net>
Date: Sun, 14 Jan 2007 14:32:57 -0600
> Fix over-optimization by GCC near ip_fast_csum.
>
> In some cases such as:
> iph->check = 0;
> iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
> GCC may optimize out the previous store.
>
> Observed as a failure of NFS over udp (bad checksums on ip fragments) when
> compiled with GCC 3.4.2.
>
> Signed-off-by: Bob Breuer <breuerr@mc.net>
Thanks for finding this bug, patch applied.
This issue may be why I made ip_fast_csum() non-inlined on
sparc64 :-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-16 3:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-14 20:32 [PATCH] sparc32: fix gcc over-optimizatoin near ip_fast_csum Bob Breuer
2007-01-16 3:06 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.