[Simh] clang (was Re: XCode and LTO)
Nelson H. F. Beebe
beebe at math.utah.edu
Fri Apr 27 13:48:39 EDT 2012
>> Declaring "loopval" as volatile (and perhaps global, rather than on-stack, to
>> reduce chances of compiler disregarding volatile declaration) might do the
>> trick.
Yes, that should work if the compiler obeys volatile declarations. Otherwise,
a store subterfuge will work too:
(a) volatile int foo;
(b) int foo;
...
store(&foo);
In another file:
void store(int *x) { }
Both cases should force the compiler to load foo from memory, and
not optimize it away.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe at math.utah.edu -
- 155 S 1400 E RM 233 beebe at acm.org beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
More information about the Simh
mailing list