raeburn@ATHENA.MIT.EDU (Ken Raeburn) (02/09/89)
(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.