2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / fmt_g.f
blobcb73492829e545ee692d99b051dee972a7e715ae
1 ! { dg-do run }
2 ! PR47285 G format outputs wrong number of characters.
3 ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 PROGRAM FOO
5 character(len=50) :: buffer
7 WRITE(buffer,"(G0.5,'<')") -10000.
8 if (buffer.ne."-10000.<") call abort
9 WRITE(buffer,"(G1.5E5,'<')") -10000.
10 if (buffer.ne."*<") call abort
11 WRITE(buffer,"(G2.5E5,'<')") -10000.
12 if (buffer.ne."**<") call abort
13 WRITE(buffer,"(G3.5E5,'<')") -10000.
14 if (buffer.ne."***<") call abort
15 WRITE(buffer,"(G4.5E5,'<')") -10000.
16 if (buffer.ne."****<") call abort
17 WRITE(buffer,"(G5.5E5,'<')") -10000.
18 if (buffer.ne."*****<") call abort
19 WRITE(buffer,"(G6.5E5,'<')") -10000.
20 if (buffer.ne."******<") call abort
21 WRITE(buffer,"(G7.5E5,'<')") -10000.
22 if (buffer.ne."*******<") call abort
23 WRITE(buffer,"(G8.5E5,'<')") -10000.
24 if (buffer.ne."********<") call abort
25 WRITE(buffer,"(G9.5E5,'<')") -10000.
26 if (buffer.ne."*********<") call abort
27 WRITE(buffer,"(G10.5E5,'<')") -10000.
28 if (buffer.ne."**********<") call abort
29 WRITE(buffer,"(G11.5E5,'<')") -10000.
30 if (buffer.ne."***********<") call abort
31 WRITE(buffer,"(G12.5E5,'<')") -10000.
32 if (buffer.ne."************<") call abort
33 WRITE(buffer,"(G13.5E5,'<')") -10000.
34 if (buffer.ne."*************<") call abort
35 WRITE(buffer,"(G14.5E5,'<')") -10000.
36 if (buffer.ne."-10000. <") call abort
37 WRITE(buffer,"(G15.5E5,'<')") -10000.
38 if (buffer.ne." -10000. <") call abort
39 WRITE(buffer,"(G16.5E5,'<')") -10000.
40 if (buffer.ne." -10000. <") call abort
42 STOP
43 END