Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gfortran.dg / char_length_2.f90
bloba519c540fd3304d34ce7c003a0f03cfb421cc0c1
1 ! { dg-do link }
2 ! Tests the fix for PR 31250
3 ! CHARACTER lengths weren't reduced early enough for all checks of
4 ! them to be meaningful. Furthermore negative string lengths weren't
5 ! dealt with correctly.
6 CHARACTER(len=0) :: c1 ! This is OK.
7 CHARACTER(len=-1) :: c2 ! { dg-warning "CHARACTER variable has zero length" }
8 PARAMETER(I=-100)
9 CHARACTER(len=I) :: c3 ! { dg-warning "CHARACTER variable has zero length" }
10 CHARACTER(len=min(I,500)) :: c4 ! { dg-warning "CHARACTER variable has zero length" }
11 CHARACTER(len=max(I,500)) :: d1 ! no warning
12 CHARACTER(len=5) :: d2 ! no warning
14 if (len(c1) .ne. 0) call link_error ()
15 if (len(c2) .ne. len(c1)) call link_error ()
16 if (len(c3) .ne. len(c2)) call link_error ()
17 if (len(c4) .ne. len(c3)) call link_error ()
19 if (len(d1) .ne. 500) call link_error ()
20 if (len(d2) .ne. 5) call link_error ()
21 END