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/35810] [TR 15581 / F2003] Automatic reallocation on assignment to allocatable variables
Date: Sun, 28 Nov 2010 14:35:00 -0000	[thread overview]
Message-ID: <bug-35810-4-VLTftzZuMR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-35810-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from Paul Thomas <pault at gcc dot gnu.org> 2010-11-28 13:47:31 UTC ---
Author: pault
Date: Sun Nov 28 13:47:26 2010
New Revision: 167220

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167220
Log:
2010-11-28  Paul Thomas  <pault@gcc.gnu.org>

     PR fortran/35810
    * trans-array.c (gfc_trans_array_constructor): If the loop->to
    is a VAR_DECL, assume this is dynamic. In this case, use the
    counter to obtain the value and set loop->to appropriately.
    (gfc_conv_ss_descriptor): Always save the offset of a variable
    in info.saved_offset.
    (gfc_conv_ss_startstride): Do not attempt bound checking of the
    lhs of an assignment, if allocatable and f2003 is allowed.
    (gfc_conv_loop_setup): If possible, do not use an allocatable
    lhs variable for the loopspec.
    (gfc_is_reallocatable_lhs): New function.
    (get_std_lbound): New function.
    (gfc_alloc_allocatable_for_assignment): New function.
    * gfortran.h : Add flag_realloc_lhs to the options structure.
    * lang.opt : Add option f(no-)realloc-lhs.
    * invoke.texi : Document option f(no-)realloc-lhs.
    * options.c (gfc_init_options, gfc_post_options,
    gfc_handle_option): Incorporate f(no-)realloc-lhs with default
    to frealloc_lhs for -std > f95.
    * trans-array.h : Add primitive for previous.
    * trans-expr.c (gfc_conv_string_length): Return if character
    length is a variable and the expression is NULL.
    (gfc_conv_procedure_call): If the call is of the kind x = f(...)
    and the lhs is allocatable and reallocation on assignment OK,
    call gfc_alloc_allocatable_for_assignment. Do not generate the
    function call unless direct by reference.
    (realloc_lhs_loop_for_fcn_call): New function.
    (realloc_lhs_bounds_for_intrinsic_call): New function.
    (gfc_trans_arrayfunc_assign): Reallocation assignments need
    a loopinfo and for the loop bounds to be set.  With intrinsic
    functions, free the lhs data and let the library allocate the
    data array. Done by the new functions above.
    (gfc_trans_assignment_1): If the lhs is allocatable and
    reallocation on assignment is allowed, mark the lhs and use
    gfc_alloc_allocatable_for_assignment to make the reallocation.
    * trans.h : Add is_alloc_lhs bitfield to gfc_ss structure.

2010-11-28  Paul Thomas  <pault@gcc.gnu.org

    PR fortran/35810
    * gfortran.dg/realloc_on_assign_1.f03: New test.
    * gfortran.dg/realloc_on_assign_2.f03: New test.
    * gfortran.dg/transpose_2.f90: dg-option -fno-realloc-lhs.
    * gfortran.dg/unpack_bounds_1.f90: The same.
    * gfortran.dg/cshift_bounds_2.f90: The same.
    * gfortran.dg/matmul_bounds_2.f90: The same.
    * gfortran.dg/matmul_bounds_3.f90: The same.
    * gfortran.dg/matmul_bounds_4.f90: The same.
    * gfortran.dg/matmul_bounds_5.f90: The same.

Added:
    trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_1.f03
    trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_2.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/cshift_bounds_2.f90
    trunk/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90
    trunk/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90
    trunk/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90
    trunk/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90
    trunk/gcc/testsuite/gfortran.dg/transpose_2.f90
    trunk/gcc/testsuite/gfortran.dg/unpack_bounds_1.f90


  parent reply	other threads:[~2010-11-28 13:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-35810-4@http.gcc.gnu.org/bugzilla/>
2010-10-08 16:29 ` burnus at gcc dot gnu.org
2010-10-25 22:23 ` burnus at gcc dot gnu.org
2010-11-28 14:35 ` pault at gcc dot gnu.org [this message]
2010-12-30 12:18 ` janus at gcc dot gnu.org
2011-01-27 22:40 ` burnus at gcc dot gnu.org
2011-01-28 14:36 ` pault at gcc dot gnu.org
2011-01-28 15:16 ` burnus at gcc dot gnu.org
2011-01-28 15:18 ` burnus at gcc dot gnu.org
2011-01-28 15:48 ` burnus at gcc dot gnu.org
2011-01-30 18:19 ` pault at gcc dot gnu.org
2011-02-02 18:11 ` dnovillo at gcc dot gnu.org
2011-02-02 18:23 ` dnovillo at gcc dot gnu.org
2008-04-03  8:55 [Bug fortran/35810] New: [F2003] " burnus at gcc dot gnu dot org
2008-10-28 17:39 ` [Bug fortran/35810] [TR 15581 / F2003] " burnus at gcc dot gnu dot org
2008-11-10 19:47 ` pault at gcc dot gnu dot org
2008-11-28 13:30 ` mikael at gcc dot gnu dot org
2009-06-08  9:11 ` burnus at gcc dot gnu dot org
2009-08-07 19:27 ` kargl at gcc dot gnu dot org
2009-10-16 20:23 ` burnus at gcc dot gnu dot org
2010-03-31 18:05 ` burnus at gcc dot gnu dot org
2010-08-14  9:04 ` burnus 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=bug-35810-4-VLTftzZuMR@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).