public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
Date: Mon, 19 Oct 2015 14:29:00 -0000	[thread overview]
Message-ID: <bug-67933-4-9N8lryLERe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67933-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #2)
> The generated finalization wrapper has code doing
>   deallocate(ptr2%classes(:)%class_var)
> where ptr2 is a pointer of type list_t to be finalized.
> This is missing scalarization, a correct code would do instead:
>   do i=1,size(ptr2)
>     ptr3 => ptr2%classes(i)
>     deallocate (ptr3%class_var)
>   end do

Hi Mikael,

This does not seem to be the problem. It is actually the
              gfc_reset_vptr (&se.pre, al->expr);
at trans-stmt.c:6048.

Once gfc_reset_vptr is modified to quit if it doesn't find a vptr, compilation
succeeds and the finalizer has:

S.7 = 0;
while (1)
  {
    if (S.7 > 9) goto L.11;
    if (ptr2->classes[S.7].class_var._data != 0B &&
                           ptr2->classes[S.7].class_var._vptr->_final != 0B)
      {
        desc.8.dtype = 296;
        desc.8.data = (void * restrict) ptr2->classes[S.7].class_var._data;
        ptr2->classes[S.7].class_var._vptr->_final (&desc.8, (integer(kind=8)) 
        ptr2->classes[S.7].class_var._vptr->_size, 1);
      }
    if (ptr2->classes[S.7].class_var._data != 0B)
      {
         __builtin_free ((void *) ptr2->classes[S.7].class_var._data);
      }
    ptr2->classes[S.7].class_var._data = 0B;
    S.7 = S.7 + 1;
  }
L.11:;

I'll post the patch as soon as I understand where the vptr's go to.

Cheers

Paul


  parent reply	other threads:[~2015-10-19 14:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 14:06 [Bug fortran/67933] New: [4.9/5/Trunk " mandrew9 at vt dot edu
2015-10-13  9:36 ` [Bug fortran/67933] [4.9/5/6 " rguenth at gcc dot gnu.org
2015-10-13  9:55 ` dominiq at lps dot ens.fr
2015-10-18 21:30 ` mikael at gcc dot gnu.org
2015-10-19 14:29 ` pault at gcc dot gnu.org [this message]
2015-10-20 15:06 ` mikael at gcc dot gnu.org
2015-10-26 18:01 ` [Bug fortran/67933] [5/6 " pault at gcc dot gnu.org
2015-10-28  9:10 ` [Bug fortran/67933] [5 " schwab@linux-m68k.org
2015-10-28  9:27 ` paul.richard.thomas at gmail dot com
2015-10-28 19:29 ` pault 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-67933-4-9N8lryLERe@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).