| 1 |
! { dg-do run } |
| 2 |
! { dg-options -O2 } |
| 3 |
! Tests the fix for PRs29507 and 31404, where elemental functions in |
| 4 |
! initialization expressions could not be simplified with array arguments. |
| 5 |
! |
| 6 |
! Contributed by Steve Kargl <[email protected] > |
| 7 |
! and Vivek Rao <[email protected]> |
| 8 |
! |
| 9 |
real, parameter :: a(2,2) = reshape ((/1.0, 2.0, 3.0, 4.0/), (/2,2/)) |
| 10 |
real, parameter :: b(2,2) = sin (a) |
| 11 |
character(8), parameter :: oa(1:3)=(/'nint() ', 'log10() ', 'sqrt() '/) |
| 12 |
integer, parameter :: ob(1:3) = index(oa, '(') |
| 13 |
character(6), parameter :: ch(3) = (/"animal", "person", "mantee"/) |
| 14 |
character(1), parameter :: ch2(3) = (/"n", "r", "t"/) |
| 15 |
integer, parameter :: i(3) = index (ch, ch2) |
| 16 |
integer :: ic(1) = len_trim((/"a"/)) |
| 17 |
|
| 18 |
if (any (reshape (b, (/4/)) .ne. (/(sin(real(k)), k = 1,4)/))) STOP 1 |
| 19 |
if (any (ob .ne. (/5,6,5/))) STOP 2 ! Original PR29507 |
| 20 |
if (any (i .ne. (/2,3,4/))) STOP 3 |
| 21 |
if (ic(1) .ne. 1) STOP 4 ! Original PR31404 |
| 22 |
end |