PR c/29467
[official-gcc.git] / gcc / testsuite / gfortran.dg / fmt_error_3.f90
blob257f876ed80de482cc54cbde2bdeceecd98155fc
1 ! { dg-do compile }
3 ! PR fortran/29835
4 ! Check for improved format error messages with correct locus and more detailed
5 ! "unexpected element" messages.
7 SUBROUTINE format_labels
8 IMPLICIT NONE
10 1 FORMAT (A, &
11 A, &
12 Q, & ! { dg-error "Unexpected element 'Q'" }
15 2 FORMAT (A, &
16 I, & ! { dg-error "Nonnegative width" }
19 END SUBROUTINE format_labels
21 SUBROUTINE format_strings
22 IMPLICIT NONE
23 CHARACTER(len=32), PARAMETER :: str = "hello"
24 INTEGER :: x
26 PRINT '(A, Q, A)', & ! { dg-error "Unexpected element 'Q'" }
27 str, str, str ! { dg-bogus "Unexpected element" }
29 PRINT '(A, ' // & ! { dg-error "Nonnegative width" }
30 ' I, ' // &
31 ' A)', str, str, str ! { dg-bogus "Nonnegative width" }
33 READ '(Q)', & ! { dg-error "Unexpected element 'Q'" }
34 x ! { dg-bogus "Unexpected element" }
36 END SUBROUTINE format_strings