Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #5334
| From | Pete Becker <pete@versatilecoding.com> |
|---|---|
| Organization | Roundhouse Consulting, Ltd. |
| Newsgroups | comp.lang.c++ |
| Date | 2011-05-22 08:39 -0400 |
| Message-ID | <2011052208390816587-pete@versatilecodingcom> (permalink) |
| References | <e627bb96-b05b-43ac-b6e8-e0ddaf62f9cc@l30g2000vbn.googlegroups.com> <db3320a1-d7d6-4337-af40-10ea1b9a76ee@q12g2000prb.googlegroups.com> <bdb12766-bf2e-4b3c-ab57-7f07e0e530f9@j25g2000vbr.googlegroups.com> |
| Subject | Re: Optimization problem |
On 2011-05-22 04:47:20 -0400, hamze said: > On May 22, 12:25 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote: >> On May 21, 11:29 pm, hamze <hamz...@gmail.com> wrote: >> >>> I have a special device in my system, I must work with it in this >>> manner that : write 4 bytes and read 3 bytes, >>> this device has no reset, so if one of reads or writes miss, from that >>> time device will not work correctly because order of writes and reads >>> are missed. >> >>> this device works right when optimization is off, but when I turn it >>> on it stop working properly in my code. >>> some time i did not use one of its read value, so I think optimization >>> remove it and order of read and writes are missed. >>> how can I solve this problem ? >>> I also test this solution that I defined an asm valotile ( ) and put >>> all reads and write inside it but still turning optimization on >>> corrupt my program result. >> >> From what I've heard in this group, volatile alone is insufficient for >> correct MMIO (memory mapped IO) on most systems. I would suggest >> looking at the docs for your implementation to see what it says about >> correct MMIO. You could also look at the output assembly to see if it >> is indeed not doing as you want. > > thanks alot, you gave me a valuable clue, > I know what is my hardware correct order of MMIO, but I dont know how > to make compiler know about it and force compile not to REORDER my > code. Since there's no code here, just a bunch of hand-waving, it's impossible to say definitively what's going on. But the compiler is not allowed to reorder or combine accesses to volatile objects. -- Pete Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The Standard C++ Library Extensions: a Tutorial and Reference (www.petebecker.com/tr1book)
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Optimization problem hamze <hamze60@gmail.com> - 2011-05-21 23:29 -0700
Re: Optimization problem Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-22 01:25 -0700
Re: Optimization problem hamze <hamze60@gmail.com> - 2011-05-22 01:47 -0700
Re: Optimization problem Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-05-22 11:40 +0000
Re: Optimization problem Pete Becker <pete@versatilecoding.com> - 2011-05-22 08:39 -0400
Re: Optimization problem Nobody <nobody@nowhere.com> - 2011-05-22 15:01 +0100
Re: Optimization problem Geoff <geoff@invalid.invalid> - 2011-05-22 09:14 -0700
csiph-web