OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [alloc_comp_assign_5.f90] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
! { dg-do run }
! { dg-do run }
! { dg-options "-O2" }
! { dg-options "-O2" }
! Tests the fix for PR29428, in which the assignment of
! Tests the fix for PR29428, in which the assignment of
! a function result would result in the function being
! a function result would result in the function being
! called twice, if it were not a result by reference,
! called twice, if it were not a result by reference,
! because of a spurious nullify in gfc_trans_scalar_assign.
! because of a spurious nullify in gfc_trans_scalar_assign.
!
!
! Contributed by Paul Thomas  
! Contributed by Paul Thomas  
!
!
program test
program test
implicit none
implicit none
  type A
  type A
    integer, allocatable :: j(:)
    integer, allocatable :: j(:)
  end type A
  end type A
  type(A):: x
  type(A):: x
  integer :: ctr = 0
  integer :: ctr = 0
  x = f()
  x = f()
  if (ctr /= 1) call abort ()
  if (ctr /= 1) call abort ()
contains
contains
  function f()
  function f()
    type(A):: f
    type(A):: f
      ctr = ctr + 1
      ctr = ctr + 1
      f = A ((/1,2/))
      f = A ((/1,2/))
  end function f
  end function f
end program
end program
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.