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] - Blame information for rev 868

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! { dg-options "-O2" }
3
! Tests the fix for PR29428, in which the assignment of
4
! a function result would result in the function being
5
! called twice, if it were not a result by reference,
6
! because of a spurious nullify in gfc_trans_scalar_assign.
7
!
8
! Contributed by Paul Thomas  
9
!
10
program test
11
implicit none
12
 
13
  type A
14
    integer, allocatable :: j(:)
15
  end type A
16
 
17
  type(A):: x
18
  integer :: ctr = 0
19
 
20
  x = f()
21
 
22
  if (ctr /= 1) call abort ()
23
 
24
contains
25
 
26
  function f()
27
    type(A):: f
28
      ctr = ctr + 1
29
      f = A ((/1,2/))
30
  end function f
31
 
32
end program
33
 

powered by: WebSVN 2.1.0

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