public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/39242] [4.4 Regression] Inconsistent reject / accept of code
Date: Thu, 19 Feb 2009 16:55:00 -0000	[thread overview]
Message-ID: <20090219165454.1308.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39242-10053@http.gcc.gnu.org/bugzilla/>



------- Comment #11 from rguenther at suse dot de  2009-02-19 16:54 -------
Subject: Re:  [4.4 Regression] Inconsistent reject / accept
 of code

On Thu, 19 Feb 2009, mark at codesourcery dot com wrote:

> ------- Comment #10 from mark at codesourcery dot com  2009-02-19 16:41 -------
> Subject: Re:  [4.4 Regression] Inconsistent reject / accept
>  of code
> 
> rguenth at gcc dot gnu dot org wrote:
> 
> > The ultimate question is of course if the standard allows (or even requires)
> > an error here.
> 
> The (someone old) C++ WP I have is pretty clear:
> 
> "An explicit instantiation declaration that names a class template
> specialization has no effect on the class template specialization
> itself (except for perhaps resulting in its implicit instantiation).
> Except for inline functions, other explicit
> instantiation declarations have the effect of suppressing the implicit
> instantiation of the entity to which they refer. [ Note:
> The intent is that an inline function that is the subject of an explicit
> instantiation declaration will still be implicitly instantiated
> when used so that the body can be considered for inlining, but that no
> out-of-line copy of the inline function
> would be generated in the translation unit. ???end note ]"
> 
> Here, "inline function" is of course the C++ definition thereof, i.e.,
> functions declared "inline" or defined in the body of a class
> definition, rather than outside the class.
> 
> What that means is that we *must not* implicitly instantiate things
> declared "extern template" unless they are DECL_DECLARED_INLINE_P.  As a
> consequence, at -O3, we cannot implicitly instantiate non-inline "extern
> template" functions.
> 
> So, I think first hunk in the patch is correct.  It needs a comment,
> though, right above DECL_DECLARED_INLINE to point out that this is a
> restriction coming from the standard:
> 
> /* An explicit instantiation declaration prohibits implicit
> instantiation of non-inline functions.  With high levels of
> optimization, we would normally inline non-inline functions -- but we're
> not allowed to do that for "extern template" functions.  Therefore, we
> check DECL_DECLARED_INLINE_P, rather than possibly_inlined_p.  */
> 
> OK with that change.
> 
> I don't yet understand why the second hunk is required.

It is probably not, I just looked for all possibly_inlined_p
occurrences in instantiate_decl and tried to make sure behavior
does not depend on optimization level.

I'll split out the first part and test/submit it.

Richard.


-- 


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


  parent reply	other threads:[~2009-02-19 16:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 13:38 [Bug c++/39242] New: " rguenth at gcc dot gnu dot org
2009-02-19 13:40 ` [Bug c++/39242] " rguenth at gcc dot gnu dot org
2009-02-19 13:40 ` rguenth at gcc dot gnu dot org
2009-02-19 13:46 ` rguenth at gcc dot gnu dot org
2009-02-19 13:51 ` rguenth at gcc dot gnu dot org
2009-02-19 14:19 ` rguenth at gcc dot gnu dot org
2009-02-19 14:31 ` rguenth at gcc dot gnu dot org
2009-02-19 14:52 ` rguenth at gcc dot gnu dot org
2009-02-19 14:59 ` hubicka at ucw dot cz
2009-02-19 15:20 ` rguenth at gcc dot gnu dot org
2009-02-19 15:40 ` hubicka at ucw dot cz
2009-02-19 16:41 ` mark at codesourcery dot com
2009-02-19 16:55 ` rguenther at suse dot de [this message]
2009-02-19 16:59 ` rguenth at gcc dot gnu dot org
2009-02-19 17:39 ` jason at gcc dot gnu dot org
2009-02-20 14:40 ` hubicka at ucw dot cz
2009-02-21 12:55 ` rguenth at gcc dot gnu dot org
2009-02-21 13:09 ` rguenth at gcc dot gnu dot org
2009-02-24 14:51 ` rguenth at gcc dot gnu dot org
2009-02-24 14:52 ` rguenth at gcc dot gnu dot org

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=20090219165454.1308.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).