Commit e18547a1 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/56138 (Deferred-length character RESULT: ICE in gfc_add_modify_loc)

2012-01-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56138
        * trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
        results for functions without extra result variable.

2012-01-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56138
        * gfortran.dg/allocatable_function_6.f90: New.

From-SVN: r195570
parent 777133fe
2012-01-30 Tobias Burnus <burnus@net-b.de>
PR fortran/56138
* trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
results for functions without extra result variable.
2013-01-29 Janus Weil <janus@gcc.gnu.org> 2013-01-29 Janus Weil <janus@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org>
......
...@@ -3775,7 +3775,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) ...@@ -3775,7 +3775,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
null_pointer_node)); null_pointer_node));
} }
if ((sym->attr.dummy ||sym->attr.result) if ((sym->attr.dummy || sym->attr.result || sym->result == sym)
&& sym->ts.type == BT_CHARACTER && sym->ts.type == BT_CHARACTER
&& sym->ts.deferred) && sym->ts.deferred)
{ {
......
2012-01-30 Tobias Burnus <burnus@net-b.de>
PR fortran/56138
* gfortran.dg/allocatable_function_6.f90: New.
2013-01-29 Janus Weil <janus@gcc.gnu.org> 2013-01-29 Janus Weil <janus@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org>
......
! { dg-do run }
!
! PR fortran/56138
!
! Contributed by John Chludzinski, using the code of John Reid
!
implicit none
CHARACTER(LEN=:),ALLOCATABLE :: str
if (s_to_c("ABCdef") /= "ABCdef" .or. len(s_to_c("ABCdef")) /= 6) call abort()
str = s_to_c("ABCdef")
if (str /= "ABCdef" .or. len(str) /= 6) call abort()
str(1:3) = s_to_c("123")
if (str /= "123def" .or. len(str) /= 6) call abort()
contains
PURE FUNCTION s_to_c(string)
CHARACTER(LEN=*),INTENT(IN) :: string
CHARACTER(LEN=:),ALLOCATABLE :: s_to_c
s_to_c = string
ENDFUNCTION s_to_c
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment