c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / fmt_error_2.f90
blobae818da7f04952e90d40731ef7294b3afa4eafe3
1 ! { dg-do compile }
2 ! { dg-options "-std=legacy" }
4 ! PR 33269: we used to not simplify format strings before checking if
5 ! they were valid, leading to a missed error.
7 IMPLICIT CHARACTER*5 (h-z)
9 CHARACTER*5 f
10 CHARACTER*5 bad, good
11 parameter(bad="a", good="(a)")
13 PRINT ('a'), "hello" ! { dg-error "Missing leading left parenthesis in format string" }
14 WRITE (*, ("a")) "error" ! { dg-error "Missing leading left parenthesis in format string" }
16 PRINT 'a', "hello" ! { dg-error "Missing leading left parenthesis in format string" }
17 WRITE (*, "a") "error" ! { dg-error "Missing leading left parenthesis in format string" }
18 WRITE (*, bad) "error" ! { dg-error "Missing leading left parenthesis in format string" }
20 PRINT 'a' // ', a', "err", "or" ! { dg-error "Missing leading left parenthesis in format string" }
22 PRINT '(' // 'a' ! { dg-error "Unexpected end of format string in format string" }
24 ! the following are ok
25 PRINT "(2f5.3)", bar, foo
26 PRINT ' (a)', "hello"
27 WRITE (*, " ((a))") "hello"
28 print "(a" // ")", "all is fine"
29 print good, "great"
31 ! verify that we haven't broken non-constant expressions
32 f = "(f5.3)"
33 print f, 3.14159
34 print (f), 2.71813
35 print implicitly_typed, "something"
36 write (*, implicitly_typed_as_well) "something else"
37 END