public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57079] New: [Fortran-dev] version/type/attribute fields not set with CLASS components
Date: Fri, 26 Apr 2013 07:37:00 -0000	[thread overview]
Message-ID: <bug-57079-4@http.gcc.gnu.org/bugzilla/> (raw)


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

             Bug #: 57079
           Summary: [Fortran-dev] version/type/attribute fields not set
                    with CLASS components
    Classification: Unclassified
           Product: gcc
           Version: fortran-dev
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: pault@gcc.gnu.org
            Blocks: 56818


The following test case shows that the version etc. field is not properly set
for:

subroutine foo()
  type t2
  end type t2
  type t
    integer, allocatable :: x(:)
    class(t2), allocatable :: y(:)
    integer :: z = 55
  end type t
  type(t), allocatable :: x!(:)
   allocate(x)
end

I wrote that it is a CLASS problem, but it might also affect other allocatable
components if there is a default initializer.


The problem is that the following code is generated, i.e. the initialization is
overridden. The additional issue is that there is a missed optimization
(setting the same value multiple times) - which should be avoided if possible.
There might be also other cases, where the fields aren't properly set.


        x = (struct t *) __builtin_malloc (128);
      ...
      x->x.base_addr = 0B;
      x->x.version = 1;
      ...
      x->y._data.base_addr = 0B;
      x->y._data.version = 1;
      ...
      {
        struct t t.0;

        if (x != 0B) goto L.1;
        x = (struct t *) __builtin_calloc (1, 128);
        L.1:;
        t.0.x.base_addr = 0B;
        t.0.y._data.base_addr = 0B;
        t.0.y._vptr = (struct __vtype_foo_T2 * {ref-all}) &__vtab_foo_T2;
        t.0.z = 55;
        *x = t.0;


             reply	other threads:[~2013-04-26  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26  7:37 burnus at gcc dot gnu.org [this message]
2013-04-26  7:46 ` [Bug fortran/57079] " burnus at gcc dot gnu.org
2014-03-22 19:17 ` dominiq at lps dot ens.fr
2021-12-18  2:37 ` pinskia 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-57079-4@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).