This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR65677 - Incomplete assignment on deferred-length character variable


Hi Dominique,

I seem to have got the wrong PR number right from the moment that I
created the directory for it and kept copying it thereafter -
apologies, I will put it right.

As to the regression, the fix is simple and is attached. I had quite
forgotten about that assertion, which I am not very convinced is
necessary.

Many thanks for alerting me to these problems.

Paul

On Sun, 30 Sep 2018 at 18:16, Dominique d'Humières <dominiq@lps.ens.fr> wrote:
>
> Hi Paul,
>
> First your patch has been committed with wrong entry: 65667 instead of 65677.
>
> Second, I suspect it is responsible of the following ICE:
>
> % gfc pr72755.f90 -fno-range-check
> pr72755.f90:1485:0:
>
> 1485 |   this%buffer = transfer( c(start:iend), this%buffer )
>      |
> internal compiler error: in gfc_dep_resolver, at fortran/dependency.c:2257
>
> and
>
> % gfc pr64125_db.f90
> pr64125_db.f90:20:0:
>
> 20 |   left%chars = transfer( right, left%chars )
>    |
> internal compiler error: in gfc_dep_resolver, at fortran/dependency.c:2257
>
> for
>
> module test
> type t_string
>   private
>   character(len=:), allocatable :: chars
> end type t_string
>
> contains
>
> pure subroutine string_assign_from_array( left, right )
>
> ! The target string
>   type(t_string), intent(out) :: left
>
> ! The source string
>   character, dimension(:), intent(in) :: right
>
>
> ! Copy memory
>   allocate( character(len=size(right)) :: left%chars )
>   left%chars = transfer( right, left%chars )
>
> end subroutine string_assign_from_array
>
> end module test
>
> Cheers,
>
> Dominique
>


-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c	(revision 264724)
--- gcc/fortran/trans-expr.c	(working copy)
*************** gfc_trans_assignment_1 (gfc_expr * expr1
*** 10208,10214 ****
      string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
    else if (expr2->ts.type == BT_CHARACTER)
      {
!       if (expr1->ts.deferred && gfc_check_dependency (expr1, expr2, false))
  	rse.string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
        string_length = rse.string_length;
      }
--- 10208,10216 ----
      string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
    else if (expr2->ts.type == BT_CHARACTER)
      {
!       if (expr1->ts.deferred
! 	  && rss != gfc_ss_terminator && lss != gfc_ss_terminator
! 	  && gfc_check_dependency (expr1, expr2, false))
  	rse.string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
        string_length = rse.string_length;
      }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]