On 8/31/10 1:23 AM, Andrew Haley wrote:
On 08/28/2010 08:41 PM, Philip Prindeville wrote:
Hi.
I work a bit with Asterisk, the IP-PBX open software. There's a GSM
library that's included in the source tree.
The problem we're encountering is that when compiled with gcc 4.1.x and
4.3 or later, it works fine.
But some of our target platforms only support gcc 4.2, and when we
compile against this, the optimizer in GCC exposes the fact that someone
writing some ASM stubs forgot to correctly annotate a constraint, and
that lack of a constraint is causing the optimizer to change the
generated object more than it should.
There are a lot of lines of source code, and most of my experience with
asm() stubs has been rudimentary, so I'm asking for an outside pair of
eyeballs that might be better skilled at identifying how the asm should
be annotated than me.
How do you know that the asm is the problem?
Andrew.
I don't for sure, but the last time we had similar distortion problems it turned out because other annotation had been left out of the asm:
Index: codecs/gsm/inc/private.h
===================================================================
--- codecs/gsm/inc/private.h (revision 109711)
+++ codecs/gsm/inc/private.h (working copy)
@@ -105,7 +105,7 @@
__asm__ __volatile__(
"addl %2,%0; jno 0f; movl $0x7fffffff,%0; adcl $0,%0; 0:"
- : "=r" (a)
+ : "=&r" (a)
: "0" (a), "ir" (b)
: "cc"
);
@@ -116,7 +116,7 @@
{
__asm__ __volatile__(
"addw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:"
- : "=r" (a)
+ : "=&r" (a)
: "0" (a), "ir" (b)
: "cc"
);
@@ -127,7 +127,7 @@
{
__asm__ __volatile__(
"subw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:"
- : "=r" (a)
+ : "=&r" (a)
: "0" (a), "ir" (b)
: "cc"
);
that was the partial patch that was applied in the last iteration of dealing with this bug.