Incrementing volatiles?

Bill Currie bcurrie@tssc.co.nz
Tue Jul 14 18:59:00 GMT 1998


Andreas Schwab wrote:
> But that would be an awful special case.  All accesses to a volatile
> variable must be exactly as specified by the user, which means that they
> must never be moved, duplicated or combined.

Eh?  The user said `increment bar', not `grab bar, add one to it and
stuff the value back into bar'.  By your definition above, gcc is
broken.

Maybe gcc should have some rtxs for incrementing/decrementing a pseudo
(both ++/-- and +=/-=, so that even unoptimised code gets the
`optimised' version).  Actualy, rtxs should be defined for *ALL* <op>=
operations.  This way, if the cpu supports the stated op, the correct
asm can be generated, otherwise the rtx expands into the current form
(the whole purpose of define_expand AIUI).

Hmm.. I might look into this myself and see how far I get as I too am
interested in this issue.

Bill
-- 
Leave others their otherness



More information about the Gcc mailing list