bug in gen5200/tod/pcf8563.c

Ingolf Steinbach ingolf.steinbach at googlemail.com
Fri May 11 14:20:23 UTC 2007


On 2007-05-11, Wolfram Wadepohl <Wolfram.Wadepohl at ek-automation.com> wrote:
> The macro
> #define From_BCD( _x ) ((((_x) >> 4) * 10) + ((_x) & 0x0F))
> produces wrong code in pcf8563_get_time().

Without looking at the source, I'd guess the reason is that this is quite
a dangerous macro (it evaluates the _x argument twice). If this macro is
invoked with an argument which directly references a (volatile) register,
it might see two different values when evaluating _x.

Cheers
Ingolf



More information about the users mailing list