| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-Werror -O3" } |
| 3 |
! |
| 4 |
! Tests the fix for PR78619, in which the recursive use of 'f' at line 13 |
| 5 |
! caused an ICE. |
| 6 |
! |
| 7 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 8 |
! |
| 9 |
print *, g(1.0) ! 'g' is OK |
| 10 |
contains |
| 11 |
function f(x) result(z) |
| 12 |
real :: x, z |
| 13 |
z = sign(1.0, f) ! { dg-error "calling itself recursively|must be the same type" } |
| 14 |
end |
| 15 |
real function g(x) |
| 16 |
real :: x |
| 17 |
g = -1 |
| 18 |
g = -sign(1.0, g) ! This is OK. |
| 19 |
end |
| 20 |
end |
| 21 |
! { dg-message "all warnings being treated as errors" "" { target *-*-* } 0 } |