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

gcc bug? (was bug in gen5200/tod/pcf8563.c)



Ingolf Steinbach schrieb:

> 2007/5/15, Wolfram Wadepohl <Wolfram.Wadepohl at ek-automation.com>:
> 
>>              |    v1 = info[PCF8563_DAY_ADR-PCF8563_SECOND_ADR] &
>> PCF8563_DAY_MASK;
>>           175|    time->day = From_BCD(v1);
> 
> 
> How exactly is info declared. If it is meant to be a pointer to some
> hardware register, it should be volatile qualified (e.g. "uint32_t
> volatile* info").

     uint8_t         info[10];
     uint32_t         v1, v2;

info is filled by a function from the i2c bus

> If it is not qualified, an optimizing compiler might (IMO correctly)
> deduce that it is not necessary to place the value read from
> info[....] in the v1 variable if there is no function call between the
> assignment v1 = .... and the expanded From_BCD() macro. The compiler
> might decide that it is equivalent read the value at info[....] twice
> in the macro expansion thus leading to two different _x values.
> 


-- 
Sch?ne Gr??e aus Reutlingen

Wolfram Wadepohl
Forschung & Entwicklung

E&K AUTOMATION
Indumat GmbH & Co. KG
Siemensstra?e 3
72766 Reutlingen
Deutschland

Tel.  +49 7121 514-289
Fax   +49 7121 514-299
eMail Wolfram.Wadepohl at ek-automation.com
       W.Wadepohl at ieee.org
WWW   http://www.ek-automation.com
       http://www.indumat.de

Diese Nachricht ist keine gesch?ftliche Mitteilung i. S. des EHUG.

Bitte senden Sie mir keine Word- oder PowerPoint- (tm Microsoft) Anh?nge.
Senden Sie mir einfachen Text, HTML oder PDF.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3210 bytes
Desc: S/MIME Cryptographic Signature
Url : http://rtems.rtems.org/pipermail/rtems-users/attachments/20070515/cd30a2cb/attachment.bin