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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gfortran.dg/] [pr19928-2.f90] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
! Related to PR 19928.  Check that foo() is only called once per statement.
2
! { dg-do run }
3
program main
4
  implicit none
5
  type t
6
    integer, dimension (5) :: field
7
  end type t
8
  type (t), dimension (2) :: a
9
  integer :: calls, i, j
10
 
11
  forall (i = 1:2, j = 1:5) a(i)%field(j) = i * 100 + j
12
  calls = 0
13
  if (sum (a%field(foo(calls))) .ne. 304) call abort
14
  if (calls .ne. 1) call abort
15
  if (sum (a(foo(calls))%field) .ne. 1015) call abort
16
  if (calls .ne. 2) call abort
17
contains
18
  function foo (calls)
19
    integer :: calls, foo
20
    calls = calls + 1
21
    foo = 2
22
  end function foo
23
end program main

powered by: WebSVN 2.1.0

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