aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-12-01 06:58:04 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-12-01 06:58:04 +0000
commita41baa6442862b5ad7847d3ddf60d9ed50e55833 (patch)
tree9300fe88bbeb767ca5d194a50e0a21c529a8804e
parentada8006795ce5c3d1486c9b39c2f52dd39e71b97 (diff)
downloadgcc-a41baa6442862b5ad7847d3ddf60d9ed50e55833.zip
gcc-a41baa6442862b5ad7847d3ddf60d9ed50e55833.tar.gz
gcc-a41baa6442862b5ad7847d3ddf60d9ed50e55833.tar.bz2
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
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-decl.c31
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f9011
4 files changed, 38 insertions, 16 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f787fb7..f9fd567 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+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>
PR fortran/21302
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 63320ae..ea127d0 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -847,25 +847,24 @@ gfc_get_symbol_decl (gfc_symbol * sym)
if (TREE_CODE (length) != INTEGER_CST)
{
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);
}
}
+
+ /* 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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d55401d..d0d6b52 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR target/24475
diff --git a/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90 b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90
new file mode 100644
index 0000000..6664183
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90
@@ -0,0 +1,11 @@
+! { 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
+