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

Wolfram Wadepohl Wolfram.Wadepohl at ek-automation.com
Tue May 15 14:11:47 UTC 2007


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://lists.rtems.org/pipermail/users/attachments/20070515/cd30a2cb/attachment-0001.bin>


More information about the users mailing list