Declaring "loopval" as volatile (and perhaps global, rather than on-stack, to 
reduce chances of compiler disregarding volatile declaration) might do the 
trick.



----- Original Message ----
From: Craig A. Berry <[email protected]>
Subject: [Simh] clang (was Re:  XCode and LTO)


The comments in the code say, "To avoid smart compilers, the loopval variable 
is 
referenced in the function arguments so that the function expression is not 
loop 
invariant," which led me to the lucky guess that the compiler was inlining the 
function and then optimizing away the inlined code.  So I made the following 
(non-portable) change:

[...]

If anyone knows of a more portable way to prevent inlining of rom_swapb(), it 
seems like it would be a  good idea to do so.  
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to