From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30493 invoked by alias); 6 Mar 2003 23:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 30465 invoked by uid 71); 6 Mar 2003 23:06:00 -0000 Date: Thu, 06 Mar 2003 23:06:00 -0000 Message-ID: <20030306230600.30462.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/9881: What is an address constant expression? Reply-To: Wolfgang Bangerth X-SW-Source: 2003-03/txt/msg00294.txt.bz2 List-Id: The following reply was made to PR c++/9881; it has been noted by GNATS. From: Wolfgang Bangerth To: Richard C Bilson Cc: asharji@uwaterloo.ca, , , , Subject: Re: c++/9881: What is an address constant expression? Date: Thu, 6 Mar 2003 17:00:49 -0600 (CST) [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. At least to me, it was not at all clear what might be the reasoning why this testcase might or should not fail. I think at least we now know which clauses are relevant, and what is the question that must be decided. > 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. In the testcase, an element of the second class has slipped into the third. The question I couldn't answer was whether it belongs to class 2 or 3. If it is 3, then the previous behavior was in error. If it is 2, then the present behavior is a regression. > Previously, the constant_flag was set for the expression in question (that > is, &((bar*)&module::storage)->p) by the function build_component_addr > in cp/typecheck.c. This function was removed from the 3.3 branch: > > 2002-08-08 Nathan Sidwell > 2002-08-15 Nathan Sidwell Thanks for this very good detective work of figuring out which patch caused the problem! Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth/