| 1 |
! { dg-do run } |
| 2 |
! Test fix for PR114141 |
| 3 |
! Contributed by Steve Kargl <[email protected]> |
| 4 |
program foo |
| 5 |
implicit none |
| 6 |
real :: y = 0.0 |
| 7 |
associate (x => log(cmplx(-1,0))) |
| 8 |
y = x%im ! Gave 'Symbol ‘x’ at (1) has no IMPLICIT type' |
| 9 |
if (int(100*y)-314 /= 0) stop 1 |
| 10 |
end associate |
| 11 |
|
| 12 |
! Check wrinkle in comment 1 (parentheses around selector) of the PR is fixed. |
| 13 |
associate (x => ((log(cmplx(-1,1))))) |
| 14 |
y = x%im ! Gave 'The RE or IM part_ref at (1) must be applied to a |
| 15 |
! COMPLEX expression' |
| 16 |
if (int(100*y)-235 /= 0) stop 2 |
| 17 |
end associate |
| 18 |
|
| 19 |
! Check that more complex(pun intended!) expressions are OK. |
| 20 |
associate (x => exp (log(cmplx(-1,0))+cmplx(0,0.5))) |
| 21 |
y = x%re ! Gave 'Symbol ‘x’ at (1) has no IMPLICIT type' |
| 22 |
if (int(1000*y)+877 /= 0) stop 3 |
| 23 |
end associate |
| 24 |
|
| 25 |
! Make sure that AIMAG intrinsic is OK. |
| 26 |
associate (x => ((log(cmplx(-1,0.5))))) |
| 27 |
y = aimag (x) |
| 28 |
if (int(100*y)-267 /= 0) stop 4 |
| 29 |
end associate |
| 30 |
end program |