The attached test case failed with an ICE for function result variables
as in that case the function decl was used.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Other pending patches:
* 4.8/4.9 regression with defined assignment:
http://gcc.gnu.org/ml/fortran/2013-06/msg00047.html
* Finalize nonallocatables with intent(out):
http://gcc.gnu.org/ml/fortran/2013-06/msg00048.html
Tobias
2013-06-06 Tobias Burnus <bur...@net-b.de>
PR fortran/57535
* trans-array.c (build_class_array_ref): Fix ICE for
function result variables.
2013-06-06 Tobias Burnus <bur...@net-b.de>
PR fortran/57535
* gfortran.dg/class_array_18.f90: New.
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 89f26d7..a4321cc 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2991,7 +2991,13 @@ build_class_array_ref (gfc_se *se, tree base, tree index)
if (ts == NULL)
return false;
- if (class_ref == NULL)
+ if (class_ref == NULL && expr->symtree->n.sym->attr.function
+ && expr->symtree->n.sym == expr->symtree->n.sym->result)
+ {
+ gcc_assert (expr->symtree->n.sym->backend_decl == current_function_decl);
+ decl = gfc_get_fake_result_decl (expr->symtree->n.sym, 0);
+ }
+ else if (class_ref == NULL)
decl = expr->symtree->n.sym->backend_decl;
else
{
--- /dev/null 2013-06-06 09:52:08.544104880 +0200
+++ gcc/gcc/testsuite/gfortran.dg/class_array_18.f90 2013-06-06 16:57:46.838820509 +0200
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR fortran/57535
+!
+program test
+ implicit none
+ type t
+ integer :: ii = 55
+ end type t
+contains
+ function func2()
+ class(t), allocatable :: func2(:)
+ allocate(func2(3))
+ func2%ii = [111,222,333]
+ end function func2
+end program test