http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
--- Comment #6 from NickParker at Eaton dot com 2011-09-07 21:18:59 UTC ---
>> How is TCNT1 defined? Again just attach the preprocessed source.
Sorry, not sure how to get preprocessed source - I need to read the GCC manual.
>From AVR header file
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
--- Comment #5 from NickParker at Eaton dot com 2011-09-07 21:16:02 UTC ---
So if its not a bug, what is the solution to this problem?
I tried wrapping up the code I wanted to time in a separate C function, but the
compiler still optimised my prob
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
--- Comment #4 from Andrew Pinski 2011-09-07
21:14:39 UTC ---
How is TCNT1 defined? Again just attach the preprocessed source.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
--- Comment #3 from NickParker at Eaton dot com 2011-09-07 21:13:22 UTC ---
#define T1_GET_TIMER_NON_ATOMIC() (TCNT1)
uint16_t BGndTimerReadNowIsr(void)
{
uint16_t period_u2;
period_u2 = T1_GET_TIMER_NON_ATOMIC();
return(period_u2);
}
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
Richard Guenther changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50314
--- Comment #1 from Andrew Pinski 2011-09-07
07:55:15 UTC ---
> but I certainly didnt expect GCC to break my C statements and order them as
> it wishes!
It should be able to do that if the side effects are not exposed to the
compiler. Can you