Commit 93755deb by Harald Anlauf Committed by Harald Anlauf

re PR fortran/83515 (ICE: Invalid expression in gfc_element_size)

2019-03-31  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/83515
	PR fortran/85797
	* trans-types.c (gfc_typenode_for_spec): Handle conversion for
	procedure pointers.
	* target-memory.c (gfc_element_size): Handle size determination
	for procedure pointers.

	PR fortran/83515
	PR fortran/85797
	* gfortran.dg/pr85797.f90: New test.

From-SVN: r270045
parent 60e8cda6
2019-03-31 Harald Anlauf <anlauf@gmx.de>
PR fortran/83515
PR fortran/85797
* trans-types.c (gfc_typenode_for_spec): Handle conversion for
procedure pointers.
* target-memory.c (gfc_element_size): Handle size determination
for procedure pointers.
2019-03-31 Thomas Koenig <tkoenig@gcc.gnu.org> 2019-03-31 Thomas Koenig <tkoenig@gcc.gnu.org>
* dump-parse-tree.c (debug): Add for symbol_attribute *, * dump-parse-tree.c (debug): Add for symbol_attribute *,
......
...@@ -120,6 +120,7 @@ gfc_element_size (gfc_expr *e, size_t *siz) ...@@ -120,6 +120,7 @@ gfc_element_size (gfc_expr *e, size_t *siz)
case BT_CLASS: case BT_CLASS:
case BT_VOID: case BT_VOID:
case BT_ASSUMED: case BT_ASSUMED:
case BT_PROCEDURE:
{ {
/* Determine type size without clobbering the typespec for ISO C /* Determine type size without clobbering the typespec for ISO C
binding types. */ binding types. */
......
...@@ -1194,6 +1194,9 @@ gfc_typenode_for_spec (gfc_typespec * spec, int codim) ...@@ -1194,6 +1194,9 @@ gfc_typenode_for_spec (gfc_typespec * spec, int codim)
basetype = pfunc_type_node; basetype = pfunc_type_node;
} }
break; break;
case BT_PROCEDURE:
basetype = pfunc_type_node;
break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
......
2019-03-31 Harald Anlauf <anlauf@gmx.de>
PR fortran/83515
PR fortran/85797
* gfortran.dg/pr85797.f90: New test.
2019-03-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2019-03-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/attr-aligned-3.c: Enable on *-*-solaris2.*. * gcc.dg/attr-aligned-3.c: Enable on *-*-solaris2.*.
......
! { dg-do compile }
! { dg-options "-Wall" }
! PR fortran/83515 - ICE: Invalid expression in gfc_element_size
! PR fortran/85797 - ICE in gfc_element_size, at fortran/target-memory.c:126
subroutine a
c = transfer (a, b) ! { dg-warning "Non-RECURSIVE procedure" }
end
recursive subroutine d
c = transfer (d, b)
end
recursive subroutine e
k = transfer (transfer (e, e), 1)
end
subroutine f
use, intrinsic :: iso_c_binding
integer(c_intptr_t) :: b, c
c = transfer (transfer (b, a), b)
end
module m
contains
function f () result (z) ! { dg-warning "Return value" }
class(*), pointer :: z
end function f
recursive subroutine s (q)
procedure(f) :: q
call s (q)
end subroutine s
end
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