1! { dg-do compile }
2! Tests the fix for PR 31250.
3! The fix for PR fortran/67987 supercedes PR 31250, which removes
4! the -Wsurprising option.
5!
6CHARACTER(len=0) :: c1   ! This is OK.
7CHARACTER(len=-1) :: c2
8PARAMETER(I=-100)
9CHARACTER(len=I) :: c3
10CHARACTER(len=min(I,500)) :: c4
11CHARACTER(len=max(I,500)) :: d1  ! no warning
12CHARACTER(len=5) :: d2   ! no warning
13
14if (len(c1) .ne. 0) call link_error ()
15if (len(c2) .ne. len(c1)) call link_error ()
16if (len(c3) .ne. len(c2)) call link_error ()
17if (len(c4) .ne. len(c3)) call link_error ()
18
19if (len(d1) .ne. 500) call link_error ()
20if (len(d2) .ne. 5) call link_error ()
21END
22