This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: volatile [was: GCC warnings for unused global variables]
- From: Richard Henderson <rth at redhat dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: Alexandre Oliva <aoliva at redhat dot com>, Michael Eager <eager at eagercon dot com>, Fergus Henderson <fjh at cs dot mu dot OZ dot AU>, Geoff Keating <geoffk at geoffk dot org>, jbuck at synopsys dot com, espie at quatramaran dot ens dot fr, gcc at gcc dot gnu dot org
- Date: Wed, 7 May 2003 16:13:00 -0700
- Subject: Re: volatile [was: GCC warnings for unused global variables]
- References: <or1xzbh08y.fsf@free.redhat.lsd.ic.unicamp.br> <687C0BA8-80DF-11D7-BD07-003065A77310@apple.com>
On Wed, May 07, 2003 at 03:58:24PM -0700, Mike Stump wrote:
> On Tuesday, May 6, 2003, at 09:03 PM, Alexandre Oliva wrote:
> >But then, so is a single instruction that loads, operates then stores,
> >right? The thing is that GCC doesn't ever give such instruction a
> >chance if the variable is volatile.
>
> But, obviously, it should be made to.
No, that's not obvious at all.
It means that, the behaviour of the program is going to depend on
(1) Whether the source was written as "i++" or "i += 1" or "i = i + 1".
I think this would be astonishing to most C programmers.
(2) Whether the architecture supports load/op/store instructions at all.
This reduces portability of driver code across architectures.
Given the difficulty of validating driver code in the first
place, this is surely a big lose.
(3) Whether a particular revision of an architecture issues its
load/op/store bus cycles in the same manner. IIRC, 68000 vs
68020 is an example of this sort of change.
(4) GCC has never in its history issued load/op/store operations
for volatiles, and changing it now may well break previously
written drivers. This would, in effect, be an ABI change.
r~