This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimiser and memory mapped I/O


Grant Edwards wrote:

On Thu, Sep 25, 2003 at 06:53:40PM +0200, Toralf Lund wrote:



OK, this time I think I've found a genuine problem with the
optimiser.



No, you've found a problem with your source code. :)




Consider the following code:



[...]




Simply put, the optimizer seems to think this is equivalent to



[...]


Assuming that's C code, the two _are_ equivalent -- it says
that in the language definition.



IOW, your source code is
incorrect for what you're trying to do.



Any ways around this (besides not optimising at all)?



You need to use the "volatile" qualifier.


Hmmm... Wouldn't that be the *ANSI* C spec? My code is not ANSI C, and I
haven't requrested ANSI mode...

Seriously, though. I did't really think about this, but I still might
not have written new code that way - this is an *old* app that I'm
porting. (Also, I tend to forget about "volatile" because I don't often
use constructs that would make it necessary.)

Apart from that, what I really want is a mode where gcc does not
generate assembler quite as stupidly as it does with no optimisation (in
terms of adding unnecessary move operations etc.), but where it doesn't
actually reorganise my code...

- Toralf




------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]