From: [EMAIL PROTECTED]
[...]
#include <avr/io.h>
int somma(int a, int b)
{
return a+b;
}
int main ()
{ int e = 10;
int r = 1;
r = somma(e,r);
r=r+1;
return r;
}
it's a stupid program. When debbugging it step by step the main regularly
calls somma(e,r).
After somma(e,r) finished, the control flow does not return in main at
r=r+1 but in a part of memory without code (after the exit() of the main).
Can you help me with this problem?
Just a guess: Try making 'r' volatile, i.e., change the declaration of r to
int volatile r = 1;
Because r is not used other than as the return value, the compiler might be
optimizing out accesses to the variable itself. The 'volatile' declaration
forces the compiler to retain these accesses.
HTH,
-=Dave
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list