diff options
author | Janus Weil <janus@gcc.gnu.org> | 2011-03-12 17:58:33 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2011-03-12 17:58:33 +0100 |
commit | 2e49964fd8691ca13e33df656da7fc4b27c1a77b (patch) | |
tree | 890893ed52a76d340cf3e83c06d1df4359fa7eeb | |
parent | 28a0157c80a276d5506135f7229d46d263039d3d (diff) | |
download | gcc-2e49964fd8691ca13e33df656da7fc4b27c1a77b.zip gcc-2e49964fd8691ca13e33df656da7fc4b27c1a77b.tar.gz gcc-2e49964fd8691ca13e33df656da7fc4b27c1a77b.tar.bz2 |
re PR fortran/48059 ([OOP] ICE in in gfc_conv_component_ref: character function of extended type)
2011-03-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/48059
* trans-expr.c (gfc_apply_interface_mapping_to_expr): Replace base type
for polymorphic arguments.
2011-03-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/48059
* gfortran.dg/class_41.f03: New.
From-SVN: r170906
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/class_41.f03 | 24 |
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ac95f2a..503b7b8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-03-12 Janus Weil <janus@gcc.gnu.org> + + PR fortran/48059 + * trans-expr.c (gfc_apply_interface_mapping_to_expr): Replace base type + for polymorphic arguments. + 2011-03-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/48054 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index d6c1f9f..da7cfba 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2247,6 +2247,10 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping, expr->symtree = sym->new_sym; else if (sym->expr) gfc_replace_expr (expr, gfc_copy_expr (sym->expr)); + /* Replace base type for polymorphic arguments. */ + if (expr->ref && expr->ref->type == REF_COMPONENT + && sym->expr && sym->expr->ts.type == BT_CLASS) + expr->ref->u.c.sym = sym->expr->ts.u.derived; } /* ...and to subexpressions in expr->value. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 412188a..f2b2712 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-12 Janus Weil <janus@gcc.gnu.org> + + PR fortran/48059 + * gfortran.dg/class_41.f03: New. + 2011-03-11 Dodji Seketeli <dodji@redhat.com> * g++.dg/conversion/cast3.C: New test. diff --git a/gcc/testsuite/gfortran.dg/class_41.f03 b/gcc/testsuite/gfortran.dg/class_41.f03 new file mode 100644 index 0000000..bcab2b4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_41.f03 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR 48059: [4.6 Regression][OOP] ICE in in gfc_conv_component_ref: character function of extended type +! +! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de> + +module a_module + type :: a_type + integer::length=0 + end type a_type + type,extends(a_type) :: b_type + end type b_type +contains + function a_string(this) result(form) + class(a_type),intent(in)::this + character(max(1,this%length))::form + end function a_string + subroutine b_sub(this) + class(b_type),intent(inout),target::this + print *,a_string(this) + end subroutine b_sub +end module a_module + +! { dg-final { cleanup-modules "a_module" } } |