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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [elemental.f90] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 303 jeremybenn
! Program to test elemental functions.
2
program test_elemental
3
   implicit none
4
   integer, dimension (2, 4) :: a
5
   integer, dimension (2, 4) :: b
6
   integer(kind = 8), dimension(2) :: c
7
 
8
   a = reshape ((/2, 3, 4, 5, 6, 7, 8, 9/), (/2, 4/))
9
   b = 0
10
   b(2, :) = e_fn (a(1, :), 1)
11
   if (any (b .ne. reshape ((/0, 1, 0, 3, 0, 5, 0, 7/), (/2, 4/)))) call abort
12
   a = e_fn (a(:, 4:1:-1), 1 + b)
13
   if (any (a .ne. reshape ((/7, 7, 5, 3, 3, -1, 1, -5/), (/2, 4/)))) call abort
14
   ! This tests intrinsic elemental conversion functions.
15
   c = 2 * a(1, 1)
16
   if (any (c .ne. 14)) call abort
17
 
18
   ! This triggered bug due to building ss chains in the wrong order.
19
   b = 0;
20
   a = a - e_fn (a, b)
21
   if (any (a .ne. 0)) call abort
22
 
23
   ! Check expressions involving constants
24
   a = e_fn (b + 1, 1)
25
   if (any (a .ne. 0)) call abort
26
contains
27
 
28
elemental integer(kind=4) function e_fn (p, q)
29
   integer, intent(in) :: p, q
30
   e_fn = p - q
31
end function
32
end program

powered by: WebSVN 2.1.0

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