Fortran: always reject alternate return specifier as argument of intrinsics
The intrinsics MOVE_ALLOC, C_F_POINTER, and C_F_PROCPOINTER require deferred checks of part of their actual argument types which may be of "any" type. This however excludes alternate return specifiers which therefore must be unconditionally rejected for all standard intrinsics. gcc/fortran/ChangeLog: PR fortran/99256 * intrinsic.c: Do not check formal argument type when checking arguments of intrinsics for alternate return specifiers. gcc/testsuite/ChangeLog: PR fortran/99256 * gfortran.dg/altreturn_11.f90: New test.
This commit is contained in:
parent
c76b3bc55b
commit
70e24c9682
2 changed files with 16 additions and 1 deletions
|
@ -4420,7 +4420,7 @@ do_sort:
|
|||
FOR_EACH_VEC_ELT (dummy_args, idx, f)
|
||||
{
|
||||
a = ordered_actual_args[idx];
|
||||
if (a && a->label != NULL && f->ts.type)
|
||||
if (a && a->label != NULL)
|
||||
{
|
||||
gfc_error ("ALTERNATE RETURN not permitted at %L", where);
|
||||
return false;
|
||||
|
|
15
gcc/testsuite/gfortran.dg/altreturn_11.f90
Normal file
15
gcc/testsuite/gfortran.dg/altreturn_11.f90
Normal file
|
@ -0,0 +1,15 @@
|
|||
! { dg-do compile }
|
||||
! { dg-prune-output "Obsolescent feature: Alternate-return argument" }
|
||||
! PR fortran/99256 - ICE in variable_check
|
||||
! Contributed by G.Steimetz
|
||||
|
||||
program test
|
||||
use iso_c_binding
|
||||
type(c_ptr) :: i
|
||||
type(c_funptr) :: p
|
||||
call move_alloc (*1, *2) ! { dg-error "ALTERNATE RETURN" }
|
||||
call c_f_pointer (i, *1) ! { dg-error "ALTERNATE RETURN" }
|
||||
call c_f_procpointer (p, *2) ! { dg-error "ALTERNATE RETURN" }
|
||||
1 continue
|
||||
2 stop
|
||||
end
|
Loading…
Add table
Reference in a new issue