Article View: gnu.gcc.bug
Article #2254trouble with -fvolatile and -traditional
From: Ken Raeburn
Date: Thu, 09 Feb 1989 01:47
Date: Thu, 09 Feb 1989 01:47
42 lines
1750 bytes
1750 bytes
(Using gcc 1.33, configured for vax. Optimization by default turns on
combine-regs and strength-reduce options in our config file.)
The following source file, when compiled (optimized) with -traditional
or with -Dvolatile=, generates no assembler code for the references to
the "foo" element, as would be expected, since the value read is not
really used.
#ifndef __STDC__
#define volatile
#endif
struct fooreg {
short csr;
short foo;
};
extern volatile struct fooreg *x;
void foo () {
register volatile struct fooreg *y = x;
short z;
y->csr = 0;
z = y->foo;
z = y->foo;
y->csr = 0x100;
}
However, according to the documentation, using "-fvolatile" should
cause the compiler to "consider all memory references through pointers
to be volatile," so they should not be removed. This does not appear
to be the case, neither with "-traditional -fvolatile" nor with
"-Dvolatile= -fvolatile"; neither of the references is generated.
-- Ken
P.S. Would it be reasonable to consider adding keywords "__inline"
and "__typeof" that work in the obvious way, but are not disabled when
the traditional or strict-ANSI modes are selected? I think it would
be useful to be able to do function inlining in "traditional GNU C,"
which I'm going to wind up using a lot this spring.
Technical Details
Message-ID:
<8902090147.AA00600@MULTICS.MIT.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburnShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburn From: raeburn@ATHENA.MIT.EDU (Ken Raeburn) Newsgroups: gnu.gcc.bug Subject: trouble with -fvolatile and -traditional Message-ID: <8902090147.AA00600@MULTICS.MIT.EDU> Date: 9 Feb 89 01:47:32 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 42