[Patch, fortran] PR25082 - Subroutine with RETURN value, ICE in gfc_conv_scalarized_array_ref
Bernhard Fischer
rep.nop@aon.at
Sun May 14 09:47:00 GMT 2006
Paul,
On Sat, May 13, 2006 at 06:27:59PM +0200, Paul Thomas wrote:
>:ADDPATCH fortran:
>
>According to the standard:
>
>12.5.2.6 RETURN statement
>R1226 return-stmt is RETURN [ scalar-int-expr ]
>Index: gcc/fortran/resolve.c
>===================================================================
>*** gcc/fortran/resolve.c (revision 113735)
>--- gcc/fortran/resolve.c (working copy)
>*************** resolve_code (gfc_code * code, gfc_names
>*** 4345,4353 ****
> break;
>
> case EXEC_RETURN:
>! if (code->expr != NULL && code->expr->ts.type != BT_INTEGER)
>! gfc_error ("Alternate RETURN statement at %L requires an INTEGER "
>! "return specifier", &code->expr->where);
> break;
>
> case EXEC_ASSIGN:
>--- 4345,4354 ----
> break;
>
> case EXEC_RETURN:
>! if (code->expr != NULL
>! && (code->expr->ts.type != BT_INTEGER || code->expr->rank))
>! gfc_error ("Alternate RETURN statement at %L requires an SCALAR-"
s/an SCALAR/a SCALAR/
>! "INTEGER return specifier", &code->expr->where);
> break;
>
> case EXEC_ASSIGN:
>! { dg-do compile }
>! tests the fix for pr25082 in which the return of an array by a
>! subroutine went undremarked.
>!
>! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
>!
>SUBROUTINE S1(*)
>INTEGER :: a(2)
>RETURN a ! { dg-error " requires an SCALAR" }
Likewise.
More information about the Fortran
mailing list