Commit 75a6d7da by Paul Thomas

re PR fortran/58618 (Wrong code with character substring and ASSOCIATE)

2018-10-18  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/58618
	* trans-decl.c (gfc_get_symbol_decl): Deal correctly with the
	initialization with NULL() of a deferred length pointer.

2018-10-18  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/58618
	* gfortran.dg/deferred_character_30.f90 : New test.

From-SVN: r265263
parent de0edf87
2018-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/58618
* trans-decl.c (gfc_get_symbol_decl): Deal correctly with the
initialization with NULL() of a deferred length pointer.
2018-10-17 Tobias Burnus <burnus@net-b.de> 2018-10-17 Tobias Burnus <burnus@net-b.de>
PR fortran/87632 PR fortran/87632
......
...@@ -1762,7 +1762,8 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -1762,7 +1762,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
gfc_finish_var_decl (length, sym); gfc_finish_var_decl (length, sym);
if (!sym->attr.associate_var if (!sym->attr.associate_var
&& TREE_CODE (length) == VAR_DECL && TREE_CODE (length) == VAR_DECL
&& sym->value && sym->value->ts.u.cl->length) && sym->value && sym->value->expr_type != EXPR_NULL
&& sym->value->ts.u.cl->length)
{ {
gfc_expr *len = sym->value->ts.u.cl->length; gfc_expr *len = sym->value->ts.u.cl->length;
DECL_INITIAL (length) = gfc_conv_initializer (len, &len->ts, DECL_INITIAL (length) = gfc_conv_initializer (len, &len->ts,
...@@ -1772,7 +1773,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -1772,7 +1773,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
DECL_INITIAL (length)); DECL_INITIAL (length));
} }
else else
gcc_assert (!sym->value); gcc_assert (!sym->value || sym->value->expr_type == EXPR_NULL);
} }
gfc_finish_var_decl (decl, sym); gfc_finish_var_decl (decl, sym);
......
2018-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/58618
* gfortran.dg/deferred_character_30.f90 : New test.
2018-10-18 Richard Biener <rguenther@suse.de> 2018-10-18 Richard Biener <rguenther@suse.de>
PR middle-end/87087 PR middle-end/87087
......
! { dg-do compile }
!
! Fix a regression introduced by the patch for PR70149.
!
character (:), pointer :: ptr => NULL() ! The NULL () caused an ICE.
character (6), target :: tgt = 'lmnopq'
ptr => tgt
print *, len (ptr), ptr
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