Splitting into separate files won't override optimization in LTO case since 
(tautologically) it is link-time.



----- Original Message ----
From: Nelson H. F. Beebe <[email protected]>
To: Sergey Oboguev <[email protected]>; "[email protected]" 
<[email protected]>
Cc: [email protected]
Sent: Fri, April 27, 2012 10:48:42 AM
Subject: Re: [Simh] clang (was Re: XCode and LTO)

>> 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: [email protected]  -
- 155 S 1400 E RM 233                      [email protected]  [email protected] -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------

_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to