public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/42104] [F03] runtime segfault with procedure pointer component
Date: Thu, 19 Nov 2009 13:25:00 -0000	[thread overview]
Message-ID: <20091119132533.16831.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42104-15250@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from pault at gcc dot gnu dot org  2009-11-19 13:25 -------
Martien,

Thank you very much for this report.

I have assigned it to myself and have a non-regtested fix:

As remarked by Janus, the problem is with the array argument.  The code
produced for the proc_pointer call is

      parm.13.dtype = 281;
      parm.13.dim[0].lbound = 1;
      parm.13.dim[0].ubound = 2;
      parm.13.dim[0].stride = 1;
      parm.13.data = (void *) &A.12[0];
      parm.13.offset = 0;
      D.1402 = _gfortran_internal_pack (&parm.13);
      D.1404 = funcp.p (&C.1396, D.1402);

The internal_pack should not be there, since the assumed shape formal argument
requires that a descriptor be passed.  This, in its turn comes about because
the symbol funcp is not marked as being always_explicit.

(In fact, he and I had a mid-air collision on this!)

The fix is to make use of the fact a proc_pointer component call is already
detected and can be used to suppress the internal_pack.  Thusly:

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c    (revision 153651)
+++ gcc/fortran/trans-expr.c    (working copy)
@@ -2918,7 +2918,7 @@
              f = (fsym != NULL)
                  && !(fsym->attr.pointer || fsym->attr.allocatable)
                  && fsym->as->type != AS_ASSUMED_SHAPE;
-             f = f || !sym->attr.always_explicit;
+             f = f || (!sym->attr.always_explicit && !comp);

              if (e->expr_type == EXPR_VARIABLE
                    && is_subref_array (e))

This fixes the PR but has not been regtested.  I will do this tonight.  If all
is well, I will commit as obvious, although your OK would be helpful, Janus!

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
           Severity|major                       |normal
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-11-19 10:45:21         |2009-11-19 13:25:32
               date|                            |


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


  parent reply	other threads:[~2009-11-19 13:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-19  5:52 [Bug fortran/42104] New: Segmentation fault " m dot a dot hulsen at tue dot nl
2009-11-19  5:53 ` [Bug fortran/42104] " m dot a dot hulsen at tue dot nl
2009-11-19  6:08 ` m dot a dot hulsen at tue dot nl
2009-11-19 10:45 ` [Bug fortran/42104] [F03] runtime segfault " janus at gcc dot gnu dot org
2009-11-19 11:57 ` janus at gcc dot gnu dot org
2009-11-19 13:25 ` pault at gcc dot gnu dot org [this message]
2009-11-19 21:09 ` janus at gcc dot gnu dot org
2009-11-19 21:59 ` janus at gcc dot gnu dot org
2009-11-20  4:59 ` pault at gcc dot gnu dot org
2009-11-20  6:43 ` pault at gcc dot gnu dot org
2009-11-20  6:57 ` janus at gcc dot gnu dot org
2009-11-20  7:58 ` pault at gcc dot gnu dot org
2009-12-03  5:33 ` pault 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=20091119132533.16831.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).