re PR fortran/83999 (ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:10233)

2018-10-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83999
	* resolve.c (resolve_fl_procedure): Include class functions in
	the test that elemental function results be scalar.

2018-10-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83999
	* gfortran.dg/elemental_function_4.f90 : New test.

From-SVN: r264899
This commit is contained in:
Paul Thomas 2018-10-06 15:14:29 +00:00
parent f64b9ed94c
commit 2b03b800d8
4 changed files with 32 additions and 2 deletions

View File

@ -1,4 +1,10 @@
2018-10-06 Thomas Koenig <tkoenig@gcc.gnu.org>
2018-10-06 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
* resolve.c (resolve_fl_procedure): Include class functions in
the test that elemental function results be scalar.
2018-10-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84640
* simplify.c (gfc_simplify_cshift): Extend size of hs_ex and ss_ex

View File

@ -12503,7 +12503,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
/* An elemental function is required to return a scalar 12.7.1 */
if (sym->attr.elemental && sym->attr.function && sym->as)
if (sym->attr.elemental && sym->attr.function
&& (sym->as || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)))
{
gfc_error ("ELEMENTAL function %qs at %L must have a scalar "
"result", sym->name, &sym->declared_at);

View File

@ -1,3 +1,8 @@
2018-10-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83999
* gfortran.dg/elemental_function_4.f90 : New test.
2018-10-05 Peter Bergner <bergner@linux.ibm.com>
PR rtl-optimization/86939

View File

@ -0,0 +1,18 @@
! { dg-do compile }
!
! Tests the fix for PR83999, where the invalid function 'f' caused an ICE.
!
! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
!
program p
type t
integer :: a
end type
type(t) :: x(3)
x = f()
print *, x
contains
elemental function f() result(z) ! { dg-error "must have a scalar result" }
type(t), pointer :: z(:)
end
end