public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings
Date: Mon, 19 Aug 2013 15:25:00 -0000	[thread overview]
Message-ID: <bug-53655-4-cY83me2XVx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53655-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> b) For bar's "x" there is no warning as it is sym->attr.referenced, but I
> think one should warn that the "declared type" does not have an initializer.

With 4.9 trunk, the following code is generated for 'bar':


bar (struct __class_MAIN___T2 & restrict x)
{
  if (x->_vptr->_final != 0B)
    {
      {
        struct array0_unknown desc.0;

        desc.0.dtype = 600;
        desc.0.data = (void * restrict) x->_data;
        x->_vptr->_final (&desc.0, x->_vptr->_size, 0);
      }
    }
  (void) __builtin_memcpy ((void *) x->_data, (void *) x->_vptr->_def_init,
(unsigned long) x->_vptr->_size);
}


The _final call is new in 4.9, but the memcpy from _def_init appeared already
with 4.7 and 4.8. (Possibly this is what sets sym->referenced?)


However, I'm not convinced that one should throw a warning here: Even if the
declared type does not have a default initializer, an extended type might have
one and of course we don't know the actual (dynamic) type of the class variable
at compile time (that's why we have the _def_init after all).


  parent reply	other threads:[~2013-08-19 15:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13  9:10 [Bug fortran/53655] New: [] burnus at gcc dot gnu.org
2012-06-13  9:18 ` [Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings burnus at gcc dot gnu.org
2012-06-13  9:21 ` burnus at gcc dot gnu.org
2013-08-19 14:25 ` janus at gcc dot gnu.org
2013-08-19 15:25 ` janus at gcc dot gnu.org [this message]
2013-08-19 20:45 ` [Bug fortran/53655] [OOP] " janus at gcc dot gnu.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=bug-53655-4-cY83me2XVx@http.gcc.gnu.org/bugzilla/ \
    --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).