This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> From bangerth at ticam dot utexas dot 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]