public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Richard C Bilson <rcbilson@plg2.math.uwaterloo.ca> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/9881: What is an address constant expression? Date: Thu, 06 Mar 2003 22:46:00 -0000 [thread overview] Message-ID: <20030306224601.11454.qmail@sources.redhat.com> (raw) 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: asharji@uwaterloo.ca, bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, pabuhr@uwaterloo.ca Cc: Subject: Re: c++/9881: What is an address constant expression? Date: Thu, 6 Mar 2003 17:39:58 -0500 (EST) > 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, let me ask a different question: was the change in gcc's behavior for this example intentional or accidental? 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. So, if the change was accidental, relying on the standard to justify the current behavior is simply a way of avoiding the work it would take to restore the previous (better) behavior. I don't mean any disrespect to the gcc developers there -- their priorities are undoubtedly different from ours. Peter asked me to look into this, and some debugging has convinced me that the change was accidental. 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 <nathan@codesourcery.com> * typeck.c (build_component_addr): Remove. (build_unary_op): Just check it's not a bitfield, and then build an ADDR_EXPR. The intent here seems to have been to simplify the code by removing a function that was unnecessarily complicated. However, the result was an oversimplification, as evidenced by 2002-08-15 Nathan Sidwell <nathan@codesourcery.com> PR c++/7598 * typeck.c (build_unary_op): Fold offsetof idiom. Fixes regression caused by my 2002-08-08 patch. The code in question is very similar to offsetof, but it doesn't quite pass the test that Mr. Sidwell put in to fix offsetof. As a result, the expression is no longer marked as constant. I am going to try to determine a more appropriate test to go in its place. Others who are more familiar with the g++ source are encouraged to try as well. - Richard
next reply other threads:[~2003-03-06 22:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-06 22:46 Richard C Bilson [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-04-21 11:30 nathan 2003-04-08 18:39 nathan 2003-03-10 20:36 Richard C Bilson 2003-03-08 14:16 Nathan Sidwell 2003-03-07 19:36 Richard C Bilson 2003-03-07 16:26 Nathan Sidwell 2003-03-07 14:56 Richard C Bilson 2003-03-06 23:06 Wolfgang Bangerth 2003-03-05 22:10 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030306224601.11454.qmail@sources.redhat.com \ --to=rcbilson@plg2.math.uwaterloo.ca \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).