[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Gcc bug??
From: |
Klaus Rudolph |
Subject: |
Re: [avr-gcc-list] Gcc bug?? |
Date: |
Wed, 03 Mar 2004 07:44:37 +0100 |
Brian Cuthie wrote:
>
> I'm having some problems with an app that uses AvrX and gcc (v. 3.3.1) on an
> ATmega16. In the interrupt routine for the TWI I write a static with a code
> that indicates its current state. In an effort to debug a different problem
> I compiled the code without any optimization.
>
> While I did discover the original problem I had been hunting, I started to
> see some very unreliable behavior with the TWI. After some investigation I
> determined that the state variable (mentioned above) was getting written
> with an unreasonable value (not a valid state). The correct state value that
> should have been written into the variable is "0". Further experiments
> revealed that memory corruption (at least directly into the variable's
> memory location) was not the problem.
>
> What I then determined is that the "0" register (r1) contained the value 8!
> This, not coincidentally (and looking at the disassembled code) is exactly
> the value that's being incorrectly written into the static state variable.
> Interestingly, turning on any level of optimization seems to fix it, at
> least as observed by the TWI port handler not hanging.
>
> I was wondering if anyone else has seen anything like this, or has any
> advice or suggestions.
Can we have a look inside the code itself? Please cut all unneeded stuff
away
and send us the source code and the Makefile with the good and the
corrupt
compile options. It is a bit difficult to say: Is it possible that
gcc has a bug or not :-)
Please comment the code that the corrupt lines can be found fast.
Thanks
Klaus
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list