[Top][All Lists]

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

[avr-gcc-list] Tiny bug with inline funcs

From: Ludovic COURTES
Subject: [avr-gcc-list] Tiny bug with inline funcs
Date: Fri, 18 May 2001 12:32:48 +0200


I noticed a kind of bug with gcc inline funcs. I have two functions f_sin()
and f_cos() (they compute cosinus and sinus and return a fixed point number)
which are static inline. When I do
        f_cos(angle); f_sin(angle);
angle is not reloaded in between function calls. The matter is that my functions
(which contains inline asm) stores their argument in Z and then modify it
(thus, input operand constraint is "Z"(angle) ) ; so the second call doesn't
have the right value of the argument.

I fixed it by declaring the argument "static volatile" (so that it is stored in
SRAM and reloaded when necessary). But is it a normal gcc behaviour ?

Ludovic Courtes
  University of Technology of Belfort-Montbeliard
  Unitec (UTBM's students Robotics Club)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]