c++/9881: What is an address constant expression?

Richard C Bilson rcbilson@plg2.math.uwaterloo.ca
Fri Mar 7 14:56:00 GMT 2003


The following reply was made to PR c++/9881; it has been noted by GNATS.

From: Richard C Bilson <rcbilson@plg2.math.uwaterloo.ca>
To: bangerth@ticam.utexas.edu
Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, nathan@codesourcery.com,
        pabuhr@uwaterloo.ca
Subject: Re: c++/9881: What is an address constant expression?
Date: Fri, 7 Mar 2003 09:47:19 -0500 (EST)

 > From bangerth@ticam.utexas.edu  Thu Mar  6 18:01:02 2003
 > 
 > [I cc:ed Nathan, since he might know what's going on better than at least 
 > me.]
 > 
 > > >     I think this is now analyzed. We need a language lawyer
 > > >     to look at it.
 > > 
 > > Before we start bashing each other over the head with our respective
 > > copies of the standard,
 > 
 > Well, I apologize if I seemed as if I wanted to.
 
 Not at all.  But I've seen where these discussions can end up.
 
 < snip >
 
 > > Clearly, section 3.6.2 of the standard permits an implementation to
 > > compute static initializers at compile time even if no other part of
 > > the standard requires it to do so.  Even if the desired behavior is
 > > not mandated by the standard, it's still a beneficial optimization,
 > > provided that gcc wasn't generating incorrect code because of it. 
 > 
 > While that is true, it is not the question here: the standard mandates to 
 > initialize 
 > - first dynamic data by zero
 > - then, constant initialized data by their value
 > - finally, dynamic data by their dynamically computed initializer
 > If the compiler can shortcut computations for the last category, it must 
 > not start initialization before the second class is completed, 
 > nevertheless. 
 
 Sorry, I mis-spoke -- what I was writing did not correspond exactly with
 what I was thinking.  What I meant to point out was that 3.6.2p2 permits an
 implementation to treat any initialization as a static initialization if it
 can (subject to certain restrictions that don't apply to the initializer in
 question here).  To use your terminology, this allows an implementation to
 move an initializer from class 3 to class 2.
 
 This is why I believe that the old behavior of gcc was not in error,
 regardless of how 5.19.4 is interpreted.
 
 - Richard



More information about the Gcc-prs mailing list