PR fortran/99169 - Do not clobber allocatable intent(out) dummy argument
gcc/fortran/ChangeLog: * trans-expr.c (gfc_conv_procedure_call): Do not add clobber to allocatable intent(out) argument. gcc/testsuite/ChangeLog: * gfortran.dg/intent_optimize_3.f90: New test.
This commit is contained in:
parent
3cc5f8620d
commit
2df374b337
2 changed files with 17 additions and 0 deletions
|
@ -6077,6 +6077,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
|
|||
&& !fsym->attr.allocatable && !fsym->attr.pointer
|
||||
&& !e->symtree->n.sym->attr.dimension
|
||||
&& !e->symtree->n.sym->attr.pointer
|
||||
&& !e->symtree->n.sym->attr.allocatable
|
||||
/* See PR 41453. */
|
||||
&& !e->symtree->n.sym->attr.dummy
|
||||
/* FIXME - PR 87395 and PR 41453 */
|
||||
|
|
16
gcc/testsuite/gfortran.dg/intent_optimize_3.f90
Normal file
16
gcc/testsuite/gfortran.dg/intent_optimize_3.f90
Normal file
|
@ -0,0 +1,16 @@
|
|||
! { dg-do run }
|
||||
! { dg-options "-O2" }
|
||||
! PR99169 - Segfault passing allocatable scalar into intent(out) dummy argument
|
||||
|
||||
program p
|
||||
implicit none
|
||||
integer, allocatable :: i
|
||||
allocate (i)
|
||||
call set (i)
|
||||
if (i /= 5) stop 1
|
||||
contains
|
||||
subroutine set (i)
|
||||
integer, intent(out) :: i
|
||||
i = 5
|
||||
end subroutine set
|
||||
end program p
|
Loading…
Add table
Reference in a new issue