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/47674] gfortran.dg/realloc_on_assign_5.f03: Segfault at run time for deferred (allocatable) string length
Date: Wed, 03 Aug 2011 07:24:00 -0000	[thread overview]
Message-ID: <bug-47674-4-rfIkFg28eg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47674-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-03 07:23:18 UTC ---
The problem seems to be that for strings, the dependency resolver does not
trigger: as there are no strides, certain dependencies are already handled, but
it fails if the LHS/RHS variables are the same and LHS is reallocated because
of a different (shorter) string length.

dependency.c's gfc_dep_resolver has:

        case REF_SUBSTRING:
          /* Substring overlaps are handled by the string assignment code
             if there is not an underlying dependency.  */
          return (fin_dep == GFC_DEP_OVERLAP) ? 1 : 0;

which returns 0 for:

  string = string(1:2) ! Issue: Realloc without temporary

trans-expr.c's alloc_scalar_allocatable_for_assignment handles scalars, where
the value might bet wrong.

A similar issue exists for arrays, though here there are provisions for adding
temporaries. (Cf. also trans-array.c's gfc_alloc_allocatable_for_assignment.)

I am not quite sure whether which if any part should be handled in the
depenedency analysis and which in the assignment code. At least the scalar
assignment code does not seem provide for temporaries at all.


A related issue is PR 49954: ICE with concatenated array strings.


  parent reply	other threads:[~2011-08-03  7:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10  8:43 [Bug fortran/47674] New: gfortran.dg/realloc_on_assign_5.f03: Segfault at run time burnus at gcc dot gnu.org
2011-02-12 19:28 ` [Bug fortran/47674] " burnus at gcc dot gnu.org
2011-08-03  7:24 ` burnus at gcc dot gnu.org [this message]
2013-04-08 20:25 ` [Bug fortran/47674] gfortran.dg/realloc_on_assign_5.f03: Segfault at run time for deferred (allocatable) string length tkoenig at gcc dot gnu.org
2013-06-16 20:39 ` dominiq at lps dot ens.fr
2013-09-02 11:18 ` dominiq at lps dot ens.fr
2013-11-23 14:04 ` dominiq at lps dot ens.fr
2014-03-16 10:09 ` tkoenig at gcc dot gnu.org
2014-09-28 21:48 ` bernd.edlinger at hotmail dot de
2014-12-29 17:17 ` tkoenig at gcc dot gnu.org
2015-01-05 17:16 ` tkoenig at gcc dot gnu.org
2015-01-05 19:21 ` tkoenig at gcc dot gnu.org
2015-05-16  6:04 ` tkoenig at gcc dot gnu.org
2015-06-04  9:28 ` tkoenig 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-47674-4-rfIkFg28eg@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).