diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-02-16 07:04:13 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-02-16 07:04:13 +0000 |
commit | ed78a1162c2658c6cbe9f3d1948ee41244fd425c (patch) | |
tree | ce717e2105716a8c1631ac2cc1cd0ee39d308c7c | |
parent | 1929b9988c98e9a806b57e73fd3a9885b63643e0 (diff) | |
download | gcc-ed78a1162c2658c6cbe9f3d1948ee41244fd425c.zip gcc-ed78a1162c2658c6cbe9f3d1948ee41244fd425c.tar.gz gcc-ed78a1162c2658c6cbe9f3d1948ee41244fd425c.tar.bz2 |
re PR fortran/24557 (ICE: PRINTing function result of size depending on assumed length CHARACTER dummy)
2005-02-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24557
* trans-expr.c (gfc_add_interface_mapping): Use the actual argument
for character(*) arrays, rather than casting to the type and kind
parameters of the formal argument.
2005-02-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24557
* gfortran.dg/assumed_charlen_needed_1.f90: New test.
From-SVN: r111130
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90 | 15 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5a0b387..0755ee7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2005-02-16 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/24557 + * trans-expr.c (gfc_add_interface_mapping): Use the actual argument + for character(*) arrays, rather than casting to the type and kind + parameters of the formal argument. + 2006-02-15 Toon Moene <toon@moene.indiv.nluug.nl> PR fortran/26054 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 3fbbf0e..9f5774b 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1346,6 +1346,10 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping, /* If the argument is a scalar or a pointer to an array, dereference it. */ else if (!sym->attr.dimension || sym->attr.pointer) value = build_fold_indirect_ref (se->expr); + + /* For character(*), use the actual argument's descriptor. */ + else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.cl->length) + value = build_fold_indirect_ref (se->expr); /* If the argument is an array descriptor, use it to determine information about the actual argument's shape. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 21fcc95..7f464ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-02-16 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/24557 + * gfortran.dg/assumed_charlen_needed_1.f90: New test. + 2006-02-15 Toon Moene <toon@moene.indiv.nluug.nl> PR fortran/26054 diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90 new file mode 100644 index 0000000..759e3e7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! Tests the fix for PR24557 in which the return of a +! temporary character(*) array would cause an ICE. +! +! Test case provided by Erik Edelmann <eedelmann@gcc.gnu.org> +! + character(4) :: a(2) + print *, fun (a) +contains + function fun (arg) + character (*) :: arg (10) + integer :: fun(size(arg)) + fun = 1 + end function fun +end |