Commit a41baa64 by Paul Thomas

re PR fortran/24789 ([gfortran] ICE when assigning to array of strings)

2005-12-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24789
	* trans-decl.c (gfc_get_symbol_decl):  Move the expression for
	unit size of automatic character length, dummy pointer array
	elements down a few lines from the version that fixed PR15809.

2005-12-01  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24789
	*  gfortran.dg/auto_char_dummy_array_2.f90: New test.

From-SVN: r107805
parent ada80067
2005-12-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24789
* trans-decl.c (gfc_get_symbol_decl): Move the expression for
unit size of automatic character length, dummy pointer array
elements down a few lines from the version that fixed PR15809.
2005-11-30 Bernhard Fischer <rep.nop@aon.at> 2005-11-30 Bernhard Fischer <rep.nop@aon.at>
PR fortran/21302 PR fortran/21302
......
...@@ -847,25 +847,24 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -847,25 +847,24 @@ gfc_get_symbol_decl (gfc_symbol * sym)
if (TREE_CODE (length) != INTEGER_CST) if (TREE_CODE (length) != INTEGER_CST)
{ {
gfc_finish_var_decl (length, sym); gfc_finish_var_decl (length, sym);
/* Set the element size of automatic character length
length, dummy, pointer arrays. */
if (sym->attr.pointer && sym->attr.dummy
&& sym->attr.dimension)
{
tmp = gfc_build_indirect_ref (sym->backend_decl);
etype = gfc_get_element_type (TREE_TYPE (tmp));
if (TYPE_SIZE_UNIT (etype) == NULL_TREE)
{
tmp = TYPE_SIZE_UNIT (gfc_character1_type_node);
tmp = fold_convert (TREE_TYPE (tmp), length);
TYPE_SIZE_UNIT (etype) = tmp;
}
}
gfc_defer_symbol_init (sym); gfc_defer_symbol_init (sym);
} }
} }
/* Set the element size of automatic and assumed character length
length, dummy, pointer arrays. */
if (sym->attr.pointer && sym->attr.dummy
&& sym->attr.dimension)
{
tmp = gfc_build_indirect_ref (sym->backend_decl);
etype = gfc_get_element_type (TREE_TYPE (tmp));
if (TYPE_SIZE_UNIT (etype) == NULL_TREE)
{
tmp = TYPE_SIZE_UNIT (gfc_character1_type_node);
tmp = fold_convert (TREE_TYPE (tmp), sym->ts.cl->backend_decl);
TYPE_SIZE_UNIT (etype) = tmp;
}
}
} }
/* Use a copy of the descriptor for dummy arrays. */ /* Use a copy of the descriptor for dummy arrays. */
......
2005-12-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24789
* gfortran.dg/auto_char_dummy_array_2.f90: New test.
2005-12-01 Uros Bizjak <uros@kss-loka.si> 2005-12-01 Uros Bizjak <uros@kss-loka.si>
PR target/24475 PR target/24475
! { dg-do compile }
! Test fix for pr24789 - would segfault on the assignment
! because the array descriptor size was not set.
!
! This is the example submitted by Martin Reineke <martin@mpa-garching.mpg.de>
subroutine foo(vals)
character(len = *), pointer :: vals(:)
vals = ''
end subroutine
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