public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is it possible that gcc reorders a series of read/write operations?
@ 2008-09-03  2:23 Pan ruochen
  2008-09-03  2:46 ` me22
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Pan ruochen @ 2008-09-03  2:23 UTC (permalink / raw)
  To: gcc-help

Hi All,
It is very common to read/write hardware registers frequently when
developing a hardware driver, like

$cat hw.c
#define HW_REG0  (volatile unsigned *)(HW_REG_BASE + 0x00)
#define HW_REG1  (volatile unsigned *)(HW_REG_BASE + 0x04)
...
#define HW_REGn  (volatile unsigned *)(HW_REG_BASE + 0xXX)

*HW_REG0 = 1;
*HW_REG1 = 4;
while( *HW_REG1 == 4 );
...
...

I wonder if there is any possibility that gcc reorders the read/write
operations in a way it thinks more optimal, which may be a disaster to
the hardware driver.

-------------
Best Regards,
PRC
Sep 3, 2008

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-09-08  6:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-03  2:23 Is it possible that gcc reorders a series of read/write operations? Pan ruochen
2008-09-03  2:46 ` me22
2008-09-03  4:15 ` Robert William Fuller
2008-09-03 12:28 ` Marco Manfredini
2008-09-03 16:20 ` David Daney
2008-09-04  1:12   ` Pan ruochen
2008-09-04  1:26     ` me22
2008-09-04 16:06     ` David Daney
2008-09-05  2:29       ` Pan ruochen
2008-09-05  4:01         ` David Daney
2008-09-08  2:01           ` Pan ruochen
2008-09-08  6:16             ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).