view gcc/testsuite/gfortran.dg/pr78619.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do compile }
! { dg-options "-Werror -O3" }
!
! Tests the fix for PR78619, in which the recursive use of 'f' at line 13
! caused an ICE.
!
! Contributed by Gerhard Steinmetz  <gerhard.steinmetz.fortran@t-online.de>
!
  print *, g(1.0) ! 'g' is OK
contains
  function f(x) result(z)
    real :: x, z
    z = sign(1.0, f) ! { dg-error "calling itself recursively|must be the same type" }
  end
  real function g(x)
    real :: x
    g = -1
    g = -sign(1.0, g) ! This is OK.
  end
end
! { dg-message "all warnings being treated as errors" "" { target *-*-* } 0 }