------- Additional Comments From matz at suse dot de  2005-04-28 02:46 -------
Uhm, wait.  Perhaps the optimization would be invalid for your changed example 
from comment #5, but see below.  But it will not be invalid for my initial 
testcase, 
where it missed to propagate 20.0 into setPosition. 
 
Why I think the transformation is valid _also_ for comment #5: See 3.6.2 #2: 
------------------------------- 
An implementation is permitted to perform the initialization of an object of 
namespace scope 
with static storage duration as a static initialization even if such 
initialization is not required to 
be done statically, provided that 
  * the dynamic version of the initialization does not change the 
    value of any other object of namespace scope with static storage duration 
prior to its 
     initialization, and 
  * the static version of the initialization produces the same value in the 
    initialized object as would be produced by the dynamic initialization if 
all objects not required 
    to be initialized statically were initialized dynamically. 
------------------------------------- 
 
It then goes on to provide an example which uses an inline function to 
dynamically initialize 
something, where comment #5 uses an arithmetic expression.  So I think we are 
permitted 
to do this optimization, in both, by initial example, and Andrews example from 
comment #5. 
 
Reopening. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21089

Reply via email to