summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/f/ste.c
blob: 82435bc8dc8e2bbf8a8b5e7e463a6ad242c93a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
/* ste.c -- Implementation File (module.c template V1.0)
   Copyright (C) 1995, 1996, 2000, 2002, 2003 Free Software Foundation, Inc.
   Contributed by James Craig Burley.

This file is part of GNU Fortran.

GNU Fortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Fortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Fortran; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.

   Related Modules:
      ste.c

   Description:
      Implements the various statements and such like.

   Modifications:
*/

/* Include files. */

#include "proj.h"
#include "rtl.h"
#include "toplev.h"
#include "ggc.h"
#include "ste.h"
#include "bld.h"
#include "com.h"
#include "expr.h"
#include "lab.h"
#include "lex.h"
#include "sta.h"
#include "stp.h"
#include "str.h"
#include "sts.h"
#include "stt.h"
#include "stv.h"
#include "stw.h"
#include "symbol.h"

/* Externals defined here. */


/* Simple definitions and enumerations. */

typedef enum
  {
    FFESTE_stateletSIMPLE_,	/* Expecting simple/start. */
    FFESTE_stateletATTRIB_,	/* Expecting attrib/item/itemstart. */
    FFESTE_stateletITEM_,	/* Expecting item/itemstart/finish. */
    FFESTE_stateletITEMVALS_,	/* Expecting itemvalue/itemendvals. */
    FFESTE_
  } ffesteStatelet_;

/* Internal typedefs. */


/* Private include files. */


/* Internal structure definitions. */


/* Static objects accessed by functions in this module. */

static ffesteStatelet_ ffeste_statelet_ = FFESTE_stateletSIMPLE_;
static ffelab ffeste_label_formatdef_ = NULL;
static tree (*ffeste_io_driver_) (ffebld expr);	/* do?io. */
static ffecomGfrt ffeste_io_endgfrt_;	/* end function to call. */
static tree ffeste_io_abort_;	/* abort-io label or NULL_TREE. */
static bool ffeste_io_abort_is_temp_;	/* abort-io label is a temp. */
static tree ffeste_io_end_;	/* END= label or NULL_TREE. */
static tree ffeste_io_err_;	/* ERR= label or NULL_TREE. */
static tree ffeste_io_iostat_;	/* IOSTAT= var or NULL_TREE. */
static bool ffeste_io_iostat_is_temp_;	/* IOSTAT= var is a temp. */

/* Static functions (internal). */

static void ffeste_begin_iterdo_ (ffestw block, tree *tvar, tree *tincr,
				  tree *xitersvar, ffebld var,
				  ffebld start, ffelexToken start_token,
				  ffebld end, ffelexToken end_token,
				  ffebld incr, ffelexToken incr_token,
				  const char *msg);
static void ffeste_end_iterdo_ (ffestw block, tree tvar, tree tincr,
				tree itersvar);
static void ffeste_io_call_ (tree call, bool do_check);
static void ffeste_io_impdo_ (ffebld impdo, ffelexToken impdo_token);
static tree ffeste_io_dofio_ (ffebld expr);
static tree ffeste_io_dolio_ (ffebld expr);
static tree ffeste_io_douio_ (ffebld expr);
static tree ffeste_io_ialist_ (bool have_err, ffestvUnit unit,
			       ffebld unit_expr, int unit_dflt);
static tree ffeste_io_cilist_ (bool have_err, ffestvUnit unit,
			       ffebld unit_expr, int unit_dflt,
			       bool have_end, ffestvFormat format,
			       ffestpFile *format_spec, bool rec,
			       ffebld rec_expr);
static tree ffeste_io_cllist_ (bool have_err, ffebld unit_expr,
			       ffestpFile *stat_spec);
static tree ffeste_io_icilist_ (bool have_err, ffebld unit_expr,
				bool have_end, ffestvFormat format,
				ffestpFile *format_spec);
static tree ffeste_io_inlist_ (bool have_err,
			       ffestpFile *unit_spec,
			       ffestpFile *file_spec,
			       ffestpFile *exist_spec,
			       ffestpFile *open_spec,
			       ffestpFile *number_spec,
			       ffestpFile *named_spec,
			       ffestpFile *name_spec,
			       ffestpFile *access_spec,
			       ffestpFile *sequential_spec,
			       ffestpFile *direct_spec,
			       ffestpFile *form_spec,
			       ffestpFile *formatted_spec,
			       ffestpFile *unformatted_spec,
			       ffestpFile *recl_spec,
			       ffestpFile *nextrec_spec,
			       ffestpFile *blank_spec);
static tree ffeste_io_olist_ (bool have_err, ffebld unit_expr,
			      ffestpFile *file_spec,
			      ffestpFile *stat_spec,
			      ffestpFile *access_spec,
			      ffestpFile *form_spec,
			      ffestpFile *recl_spec,
			      ffestpFile *blank_spec);
static void ffeste_subr_beru_ (ffestpBeruStmt *info, ffecomGfrt rt);

/* Internal macros. */

#define ffeste_emit_line_note_() \
  emit_line_note (input_location)
#define ffeste_check_simple_() \
  assert(ffeste_statelet_ == FFESTE_stateletSIMPLE_)
#define ffeste_check_start_() \
  assert(ffeste_statelet_ == FFESTE_stateletSIMPLE_); \
  ffeste_statelet_ = FFESTE_stateletATTRIB_
#define ffeste_check_attrib_() \
  assert(ffeste_statelet_ == FFESTE_stateletATTRIB_)
#define ffeste_check_item_() \
  assert(ffeste_statelet_ == FFESTE_stateletATTRIB_	 \
	 || ffeste_statelet_ == FFESTE_stateletITEM_); \
  ffeste_statelet_ = FFESTE_stateletITEM_
#define ffeste_check_item_startvals_() \
  assert(ffeste_statelet_ == FFESTE_stateletATTRIB_	 \
	 || ffeste_statelet_ == FFESTE_stateletITEM_); \
  ffeste_statelet_ = FFESTE_stateletITEMVALS_
#define ffeste_check_item_value_() \
  assert(ffeste_statelet_ == FFESTE_stateletITEMVALS_)
#define ffeste_check_item_endvals_() \
  assert(ffeste_statelet_ == FFESTE_stateletITEMVALS_); \
  ffeste_statelet_ = FFESTE_stateletITEM_
#define ffeste_check_finish_() \
  assert(ffeste_statelet_ == FFESTE_stateletATTRIB_	 \
	 || ffeste_statelet_ == FFESTE_stateletITEM_); \
  ffeste_statelet_ = FFESTE_stateletSIMPLE_

#define ffeste_f2c_init_charnolen_(Exp,Init,Spec)			      \
  do									      \
    {									      \
      if ((Spec)->kw_or_val_present)					      \
	Exp = ffecom_arg_ptr_to_const_expr ((Spec)->u.expr, &ignore);	      \
      else								      \
	Exp = null_pointer_node;					      \
      if (Exp)								      \
	Init = Exp;							      \
      else								      \
	{								      \
	  Init = null_pointer_node;					      \
	  constantp = FALSE;						      \
	}								      \
    } while(0)

#define ffeste_f2c_init_char_(Exp,Init,Lenexp,Leninit,Spec)		      \
  do									      \
    {									      \
      if ((Spec)->kw_or_val_present)					      \
	Exp = ffecom_arg_ptr_to_const_expr ((Spec)->u.expr, &Lenexp);	      \
      else								      \
	{								      \
	  Exp = null_pointer_node;					      \
	  Lenexp = ffecom_f2c_ftnlen_zero_node;				      \
	}								      \
      if (Exp)								      \
	Init = Exp;							      \
      else								      \
	{								      \
	  Init = null_pointer_node;					      \
	  constantp = FALSE;						      \
	}								      \
      if (Lenexp)							      \
	Leninit = Lenexp;						      \
      else								      \
	{								      \
	  Leninit = ffecom_f2c_ftnlen_zero_node;			      \
	  constantp = FALSE;						      \
	}								      \
    } while(0)

#define ffeste_f2c_init_flag_(Flag,Init)				      \
  do									      \
    {									      \
      Init = convert (ffecom_f2c_flag_type_node,			      \
		      (Flag) ? integer_one_node : integer_zero_node);	      \
    } while(0)

#define ffeste_f2c_init_format_(Exp,Init,Spec)				      \
  do									      \
    {									      \
      Exp = ffecom_arg_ptr_to_const_expr ((Spec)->u.expr, NULL);	      \
      if (Exp)								      \
	Init = Exp;							      \
      else								      \
	{								      \
	  Init = null_pointer_node;					      \
	  constantp = FALSE;						      \
	}								      \
    } while(0)

#define ffeste_f2c_init_int_(Exp,Init,Spec)				      \
  do									      \
    {									      \
      if ((Spec)->kw_or_val_present)					      \
	Exp = ffecom_const_expr ((Spec)->u.expr);			      \
      else								      \
	Exp = ffecom_integer_zero_node;					      \
      if (Exp)								      \
	Init = Exp;							      \
      else								      \
	{								      \
	  Init = ffecom_integer_zero_node;				      \
	  constantp = FALSE;						      \
	}								      \
    } while(0)

#define ffeste_f2c_init_ptrtoint_(Exp,Init,Spec)			      \
  do									      \
    {									      \
      if ((Spec)->kw_or_val_present)					      \
	Exp = ffecom_ptr_to_const_expr ((Spec)->u.expr);		      \
      else								      \
	Exp = null_pointer_node;					      \
      if (Exp)								      \
	Init = Exp;							      \
      else								      \
	{								      \
	  Init = null_pointer_node;					      \
	  constantp = FALSE;						      \
	}								      \
    } while(0)

#define ffeste_f2c_init_next_(Init)					      \
  do									      \
    {									      \
      TREE_CHAIN (initn) = build_tree_list ((field = TREE_CHAIN (field)),     \
					    (Init));			      \
      initn = TREE_CHAIN(initn);					      \
    } while(0)

#define ffeste_f2c_prepare_charnolen_(Spec,Exp)				      \
  do									      \
    {									      \
      if (! (Exp))							      \
        ffecom_prepare_arg_ptr_to_expr ((Spec)->u.expr);		      \
    } while(0)

#define ffeste_f2c_prepare_char_(Spec,Exp)				      \
  do									      \
    {									      \
      if (! (Exp))							      \
        ffecom_prepare_arg_ptr_to_expr ((Spec)->u.expr);		      \
    } while(0)

#define ffeste_f2c_prepare_format_(Spec,Exp)				      \
  do									      \
    {									      \
      if (! (Exp))							      \
        ffecom_prepare_arg_ptr_to_expr ((Spec)->u.expr);		      \
    } while(0)

#define ffeste_f2c_prepare_int_(Spec,Exp)				      \
  do									      \
    {									      \
      if (! (Exp))							      \
        ffecom_prepare_expr ((Spec)->u.expr);				      \
    } while(0)

#define ffeste_f2c_prepare_ptrtoint_(Spec,Exp)				      \
  do									      \
    {									      \
      if (! (Exp))							      \
        ffecom_prepare_ptr_to_expr ((Spec)->u.expr);			      \
    } while(0)

#define ffeste_f2c_compile_(Field,Exp)					      \
  do									      \
    {									      \
      tree exz;								      \
      if ((Exp))							      \
	{								      \
	  exz = ffecom_modify (void_type_node,				      \
			       ffecom_2 (COMPONENT_REF, TREE_TYPE (Field),    \
					 t, (Field)),			      \
			       (Exp));					      \
	  expand_expr_stmt (exz);					      \
	}								      \
    } while(0)

#define ffeste_f2c_compile_charnolen_(Field,Spec,Exp)			      \
  do									      \
    {									      \
      tree exq;								      \
      if (! (Exp))							      \
	{								      \
	  exq = ffecom_arg_ptr_to_expr ((Spec)->u.expr, &ignore);	      \
	  ffeste_f2c_compile_ ((Field), exq);				      \
	}								      \
    } while(0)

#define ffeste_f2c_compile_char_(Field,Lenfield,Spec,Exp,Lenexp)	      \
  do									      \
    {									      \
      tree exq = (Exp);							      \
      tree lenexq = (Lenexp);						      \
      int need_exq = (! exq);						      \
      int need_lenexq = (! lenexq);					      \
      if (need_exq || need_lenexq)					      \
	{								      \
	  exq = ffecom_arg_ptr_to_expr ((Spec)->u.expr, &lenexq);	      \
	  if (need_exq)							      \
	    ffeste_f2c_compile_ ((Field), exq);				      \
	  if (need_lenexq)						      \
	    ffeste_f2c_compile_ ((Lenfield), lenexq);			      \
	}								      \
    } while(0)

#define ffeste_f2c_compile_format_(Field,Spec,Exp)			      \
  do									      \
    {									      \
      tree exq;								      \
      if (! (Exp))							      \
	{								      \
	  exq = ffecom_arg_ptr_to_expr ((Spec)->u.expr, NULL);		      \
	  ffeste_f2c_compile_ ((Field), exq);				      \
	}								      \
    } while(0)

#define ffeste_f2c_compile_int_(Field,Spec,Exp)				      \
  do									      \
    {									      \
      tree exq;								      \
      if (! (Exp))							      \
	{								      \
	  exq = ffecom_expr ((Spec)->u.expr);				      \
	  ffeste_f2c_compile_ ((Field), exq);				      \
	}								      \
    } while(0)

#define ffeste_f2c_compile_ptrtoint_(Field,Spec,Exp)			      \
  do									      \
    {									      \
      tree exq;								      \
      if (! (Exp))							      \
	{								      \
	  exq = ffecom_ptr_to_expr ((Spec)->u.expr);			      \
	  ffeste_f2c_compile_ ((Field), exq);				      \
	}								      \
    } while(0)

/* Start a Fortran block.  */

#ifdef ENABLE_CHECKING

typedef struct gbe_block
{
  struct gbe_block *outer;
  ffestw block;
  location_t location;
  bool is_stmt;
} *gbe_block;

gbe_block ffeste_top_block_ = NULL;

static void
ffeste_start_block_ (ffestw block)
{
  gbe_block b = xmalloc (sizeof (*b));

  b->outer = ffeste_top_block_;
  b->block = block;
  b->location = input_location;
  b->is_stmt = FALSE;

  ffeste_top_block_ = b;

  ffecom_start_compstmt ();
}

/* End a Fortran block.  */

static void
ffeste_end_block_ (ffestw block)
{
  gbe_block b = ffeste_top_block_;

  assert (b);
  assert (! b->is_stmt);
  assert (b->block == block);
  assert (! b->is_stmt);

  ffeste_top_block_ = b->outer;

  free (b);

  ffecom_end_compstmt ();
}

/* Start a Fortran statement.

   Starts a back-end block, so temporaries can be managed, clean-ups
   properly handled, etc.  Nesting of statements *is* allowed -- the
   handling of I/O items, even implied-DO I/O lists, within a READ,
   PRINT, or WRITE statement is one example.  */

static void
ffeste_start_stmt_(void)
{
  gbe_block b = xmalloc (sizeof (*b));

  b->outer = ffeste_top_block_;
  b->block = NULL;
  b->location = input_location;
  b->is_stmt = TRUE;

  ffeste_top_block_ = b;

  ffecom_start_compstmt ();
}

/* End a Fortran statement.  */

static void
ffeste_end_stmt_(void)
{
  gbe_block b = ffeste_top_block_;

  assert (b);
  assert (b->is_stmt);

  ffeste_top_block_ = b->outer;

  free (b);

  ffecom_end_compstmt ();
}

#else  /* ! defined (ENABLE_CHECKING) */

#define ffeste_start_block_(b) ffecom_start_compstmt ()
#define ffeste_end_block_(b)	\
  do				\
    {				\
      ffecom_end_compstmt ();	\
    } while(0)
#define ffeste_start_stmt_() ffeste_start_block_(NULL)
#define ffeste_end_stmt_() ffeste_end_block_(NULL)

#endif  /* ! defined (ENABLE_CHECKING) */

/* Begin an iterative DO loop.  Pass the block to start if
   applicable.  */

static void
ffeste_begin_iterdo_ (ffestw block, tree *xtvar, tree *xtincr,
		      tree *xitersvar, ffebld var,
		      ffebld start, ffelexToken start_token,
		      ffebld end, ffelexToken end_token,
		      ffebld incr, ffelexToken incr_token,
		      const char *msg)
{
  tree tvar;
  tree expr;
  tree tstart;
  tree tend;
  tree tincr;
  tree tincr_saved;
  tree niters;
  struct nesting *expanded_loop;

  /* Want to have tvar, tincr, and niters for the whole loop body. */

  if (block)
    ffeste_start_block_ (block);
  else
    ffeste_start_stmt_ ();

  niters = ffecom_make_tempvar (block ? "do" : "impdo",
				ffecom_integer_type_node,
				FFETARGET_charactersizeNONE, -1);

  ffecom_prepare_expr (incr);
  ffecom_prepare_expr_rw (NULL_TREE, var);

  ffecom_prepare_end ();

  tvar = ffecom_expr_rw (NULL_TREE, var);
  tincr = ffecom_expr (incr);

  if (TREE_CODE (tvar) == ERROR_MARK
      || TREE_CODE (tincr) == ERROR_MARK)
    {
      if (block)
	{
	  ffeste_end_block_ (block);
	  ffestw_set_do_tvar (block, error_mark_node);
	}
      else
	{
	  ffeste_end_stmt_ ();
	  *xtvar = error_mark_node;
	}
      return;
    }

  /* Check whether incr is known to be zero, complain and fix.  */

  if (integer_zerop (tincr) || real_zerop (tincr))
    {
      ffebad_start (FFEBAD_DO_STEP_ZERO);
      ffebad_here (0, ffelex_token_where_line (incr_token),
		   ffelex_token_where_column (incr_token));
      ffebad_string (msg);
      ffebad_finish ();
      tincr = convert (TREE_TYPE (tvar), integer_one_node);
    }

  tincr_saved = ffecom_save_tree (tincr);

  /* Want to have tstart, tend for just this statement. */

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (start);
  ffecom_prepare_expr (end);

  ffecom_prepare_end ();

  tstart = ffecom_expr (start);
  tend = ffecom_expr (end);

  if (TREE_CODE (tstart) == ERROR_MARK
      || TREE_CODE (tend) == ERROR_MARK)
    {
      ffeste_end_stmt_ ();

      if (block)
	{
	  ffeste_end_block_ (block);
	  ffestw_set_do_tvar (block, error_mark_node);
	}
      else
	{
	  ffeste_end_stmt_ ();
	  *xtvar = error_mark_node;
	}
      return;
    }

  /* For warnings only, nothing else happens here.  */
  {
    tree try;

    if (! ffe_is_onetrip ())
      {
	try = ffecom_2 (MINUS_EXPR, TREE_TYPE (tvar),
			tend,
			tstart);

	try = ffecom_2 (PLUS_EXPR, TREE_TYPE (tvar),
			try,
			tincr);

	if (TREE_CODE (TREE_TYPE (tvar)) != REAL_TYPE)
	  try = ffecom_2 (TRUNC_DIV_EXPR, integer_type_node, try,
			  tincr);
	else
	  try = convert (integer_type_node,
			 ffecom_2 (RDIV_EXPR, TREE_TYPE (tvar),
				   try,
				   tincr));

	/* Warn if loop never executed, since we've done the evaluation
	   of the unofficial iteration count already.  */

	try = ffecom_truth_value (ffecom_2 (LE_EXPR, integer_type_node,
					    try,
					    convert (TREE_TYPE (tvar),
						     integer_zero_node)));

	if (integer_onep (try))
	  {
	    ffebad_start (FFEBAD_DO_NULL);
	    ffebad_here (0, ffelex_token_where_line (start_token),
			 ffelex_token_where_column (start_token));
	    ffebad_string (msg);
	    ffebad_finish ();
	  }
      }

    /* Warn if end plus incr would overflow.  */

    try = ffecom_2 (PLUS_EXPR, TREE_TYPE (tvar),
		    tend,
		    tincr);

    if ((TREE_CODE_CLASS (TREE_CODE (try)) == 'c')
	&& TREE_CONSTANT_OVERFLOW (try))
      {
	ffebad_start (FFEBAD_DO_END_OVERFLOW);
	ffebad_here (0, ffelex_token_where_line (end_token),
		     ffelex_token_where_column (end_token));
	ffebad_string (msg);
	ffebad_finish ();
      }
  }

  /* Do the initial assignment into the DO var.  */

  tstart = ffecom_save_tree (tstart);

  expr = ffecom_2 (MINUS_EXPR, TREE_TYPE (tvar),
		   tend,
		   tstart);

  if (! ffe_is_onetrip ())
    {
      expr = ffecom_2 (PLUS_EXPR, TREE_TYPE (expr),
		       expr,
		       convert (TREE_TYPE (expr), tincr_saved));
    }

  if (TREE_CODE (TREE_TYPE (tvar)) != REAL_TYPE)
    expr = ffecom_2 (TRUNC_DIV_EXPR, TREE_TYPE (expr),
		     expr,
		     tincr_saved);
  else
    expr = ffecom_2 (RDIV_EXPR, TREE_TYPE (expr),
		     expr,
		     tincr_saved);

#if 1	/* New, F90-approved approach: convert to default INTEGER. */
  if (TREE_TYPE (tvar) != error_mark_node)
    expr = convert (ffecom_integer_type_node, expr);
#else	/* Old approach; convert to INTEGER unless that's a narrowing. */
  if ((TREE_TYPE (tvar) != error_mark_node)
      && ((TREE_CODE (TREE_TYPE (tvar)) != INTEGER_TYPE)
	  || ((TYPE_SIZE (TREE_TYPE (tvar)) != NULL_TREE)
	      && ((TREE_CODE (TYPE_SIZE (TREE_TYPE (tvar)))
		   != INTEGER_CST)
		  || (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tvar)))
		      <= TREE_INT_CST_LOW (TYPE_SIZE (ffecom_integer_type_node)))))))
    /* Convert unless promoting INTEGER type of any kind downward to
       default INTEGER; else leave as, say, INTEGER*8 (long long int).  */
    expr = convert (ffecom_integer_type_node, expr);
#endif

  assert (TYPE_MAIN_VARIANT (TREE_TYPE (niters))
	  == TYPE_MAIN_VARIANT (TREE_TYPE (expr)));

  expr = ffecom_modify (void_type_node, niters, expr);
  expand_expr_stmt (expr);

  expr = ffecom_modify (void_type_node, tvar, tstart);
  expand_expr_stmt (expr);

  ffeste_end_stmt_ ();

  expanded_loop = expand_start_loop_continue_elsewhere (!! block);
  if (block)
    ffestw_set_do_hook (block, expanded_loop);

  if (! ffe_is_onetrip ())
    {
      expr = ffecom_truth_value
	(ffecom_2 (GE_EXPR, integer_type_node,
		   ffecom_2 (PREDECREMENT_EXPR,
			     TREE_TYPE (niters),
			     niters,
			     convert (TREE_TYPE (niters),
				      ffecom_integer_one_node)),
		   convert (TREE_TYPE (niters),
			    ffecom_integer_zero_node)));

      expand_exit_loop_top_cond (0, expr);
    }

  if (block)
    {
      ffestw_set_do_tvar (block, tvar);
      ffestw_set_do_incr_saved (block, tincr_saved);
      ffestw_set_do_count_var (block, niters);
    }
  else
    {
      *xtvar = tvar;
      *xtincr = tincr_saved;
      *xitersvar = niters;
    }
}

/* End an iterative DO loop.  Pass the same iteration variable and increment
   value trees that were generated in the paired _begin_ call.  */

static void
ffeste_end_iterdo_ (ffestw block, tree tvar, tree tincr, tree itersvar)
{
  tree expr;
  tree niters = itersvar;

  if (tvar == error_mark_node)
    return;

  expand_loop_continue_here ();

  ffeste_start_stmt_ ();

  if (ffe_is_onetrip ())
    {
      expr = ffecom_truth_value
	(ffecom_2 (GE_EXPR, integer_type_node,
		   ffecom_2 (PREDECREMENT_EXPR,
			     TREE_TYPE (niters),
			     niters,
			     convert (TREE_TYPE (niters),
				      ffecom_integer_one_node)),
		   convert (TREE_TYPE (niters),
			    ffecom_integer_zero_node)));

      expand_exit_loop_if_false (0, expr);
    }

  expr = ffecom_modify (void_type_node, tvar,
			ffecom_2 (PLUS_EXPR, TREE_TYPE (tvar),
				  tvar,
				  tincr));
  expand_expr_stmt (expr);

  /* Lose the stuff we just built. */
  ffeste_end_stmt_ ();

  expand_end_loop ();

  /* Lose the tvar and incr_saved trees. */
  if (block)
    ffeste_end_block_ (block);
  else
    ffeste_end_stmt_ ();
}

/* Generate call to run-time I/O routine.  */

static void
ffeste_io_call_ (tree call, bool do_check)
{
  /* Generate the call and optional assignment into iostat var. */

  TREE_SIDE_EFFECTS (call) = 1;
  if (ffeste_io_iostat_ != NULL_TREE)
    call = ffecom_modify (do_check ? NULL_TREE : void_type_node,
			  ffeste_io_iostat_, call);
  expand_expr_stmt (call);

  if (! do_check
      || ffeste_io_abort_ == NULL_TREE
      || TREE_CODE (ffeste_io_abort_) == ERROR_MARK)
    return;

  /* Generate optional test. */

  expand_start_cond (ffecom_truth_value (ffeste_io_iostat_), 0);
  expand_goto (ffeste_io_abort_);
  expand_end_cond ();
}

/* Handle implied-DO in I/O list.

   Expands code to start up the DO loop.  Then for each item in the
   DO loop, handles appropriately (possibly including recursively calling
   itself).  Then expands code to end the DO loop.  */

static void
ffeste_io_impdo_ (ffebld impdo, ffelexToken impdo_token)
{
  ffebld var = ffebld_head (ffebld_right (impdo));
  ffebld start = ffebld_head (ffebld_trail (ffebld_right (impdo)));
  ffebld end = ffebld_head (ffebld_trail (ffebld_trail
					  (ffebld_right (impdo))));
  ffebld incr = ffebld_head (ffebld_trail (ffebld_trail
				    (ffebld_trail (ffebld_right (impdo)))));
  ffebld list;
  ffebld item;
  tree tvar;
  tree tincr;
  tree titervar;

  if (incr == NULL)
    {
      incr = ffebld_new_conter (ffebld_constant_new_integerdefault_val (1));
      ffebld_set_info (incr, ffeinfo_new
		       (FFEINFO_basictypeINTEGER,
			FFEINFO_kindtypeINTEGERDEFAULT,
			0,
			FFEINFO_kindENTITY,
			FFEINFO_whereCONSTANT,
			FFETARGET_charactersizeNONE));
    }

  /* Start the DO loop.  */

  start = ffeexpr_convert_expr (start, impdo_token, var, impdo_token,
				FFEEXPR_contextLET);
  end = ffeexpr_convert_expr (end, impdo_token, var, impdo_token,
			      FFEEXPR_contextLET);
  incr = ffeexpr_convert_expr (incr, impdo_token, var, impdo_token,
			       FFEEXPR_contextLET);

  ffeste_begin_iterdo_ (NULL, &tvar, &tincr, &titervar, var,
			start, impdo_token,
			end, impdo_token,
			incr, impdo_token,
			"Implied DO loop");

  /* Handle the list of items.  */

  for (list = ffebld_left (impdo); list != NULL; list = ffebld_trail (list))
    {
      item = ffebld_head (list);
      if (item == NULL)
	continue;

      /* Strip parens off items such as in "READ *,(A)".  This is really a bug
	 in the user's code, but I've been told lots of code does this.  */
      while (ffebld_op (item) == FFEBLD_opPAREN)
	item = ffebld_left (item);

      if (ffebld_op (item) == FFEBLD_opANY)
	continue;

      if (ffebld_op (item) == FFEBLD_opIMPDO)
	ffeste_io_impdo_ (item, impdo_token);
      else
	{
	  ffeste_start_stmt_ ();

	  ffecom_prepare_arg_ptr_to_expr (item);

	  ffecom_prepare_end ();

	  ffeste_io_call_ ((*ffeste_io_driver_) (item), TRUE);

	  ffeste_end_stmt_ ();
	}
    }

  /* Generate end of implied-do construct. */

  ffeste_end_iterdo_ (NULL, tvar, tincr, titervar);
}

/* I/O driver for formatted I/O item (do_fio)

   Returns a tree for a CALL_EXPR to the do_fio function, which handles
   a formatted I/O list item, along with the appropriate arguments for
   the function.  It is up to the caller to set the TREE_SIDE_EFFECTS flag
   for the CALL_EXPR, expand (emit) the expression, emit any assignment
   of the result to an IOSTAT= variable, and emit any checking of the
   result for errors.  */

static tree
ffeste_io_dofio_ (ffebld expr)
{
  tree num_elements;
  tree variable;
  tree size;
  tree arglist;
  ffeinfoBasictype bt;
  ffeinfoKindtype kt;
  bool is_complex;

  bt = ffeinfo_basictype (ffebld_info (expr));
  kt = ffeinfo_kindtype (ffebld_info (expr));

  if ((bt == FFEINFO_basictypeANY)
      || (kt == FFEINFO_kindtypeANY))
    return error_mark_node;

  if (bt == FFEINFO_basictypeCOMPLEX)
    {
      is_complex = TRUE;
      bt = FFEINFO_basictypeREAL;
    }
  else
    is_complex = FALSE;

  variable = ffecom_arg_ptr_to_expr (expr, &size);

  if ((variable == error_mark_node)
      || (size == error_mark_node))
    return error_mark_node;

  if (size == NULL_TREE)	/* Already filled in for CHARACTER type. */
    {				/* "(ftnlen) sizeof(type)" */
      size = size_binop (CEIL_DIV_EXPR,
			 TYPE_SIZE_UNIT (ffecom_tree_type[bt][kt]),
			 size_int (TYPE_PRECISION (char_type_node)
				   / BITS_PER_UNIT));
#if 0	/* Assume that while it is possible that char * is wider than
	   ftnlen, no object in Fortran space can get big enough for its
	   size to be wider than ftnlen.  I really hope nobody wastes
	   time debugging a case where it can!  */
      assert (TYPE_PRECISION (ffecom_f2c_ftnlen_type_node)
	      >= TYPE_PRECISION (TREE_TYPE (size)));
#endif
      size = convert (ffecom_f2c_ftnlen_type_node, size);
    }

  if (ffeinfo_rank (ffebld_info (expr)) == 0
      || TREE_CODE (TREE_TYPE (TREE_TYPE (variable))) != ARRAY_TYPE)
    num_elements
      = is_complex ? ffecom_f2c_ftnlen_two_node : ffecom_f2c_ftnlen_one_node;
  else
    {
      num_elements
	= size_binop (CEIL_DIV_EXPR,
		      TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (variable))),
		      convert (sizetype, size));
      num_elements = size_binop (CEIL_DIV_EXPR, num_elements,
				 size_int (TYPE_PRECISION (char_type_node)
					   / BITS_PER_UNIT));
      num_elements = convert (ffecom_f2c_ftnlen_type_node,
			      num_elements);
    }

  num_elements
    = ffecom_1 (ADDR_EXPR, ffecom_f2c_ptr_to_ftnlen_type_node,
		num_elements);

  variable = convert (string_type_node, variable);

  arglist = build_tree_list (NULL_TREE, num_elements);
  TREE_CHAIN (arglist) = build_tree_list (NULL_TREE, variable);
  TREE_CHAIN (TREE_CHAIN (arglist)) = build_tree_list (NULL_TREE, size);

  return ffecom_call_gfrt (FFECOM_gfrtDOFIO, arglist, NULL_TREE);
}

/* I/O driver for list-directed I/O item (do_lio)

   Returns a tree for a CALL_EXPR to the do_lio function, which handles
   a list-directed I/O list item, along with the appropriate arguments for
   the function.  It is up to the caller to set the TREE_SIDE_EFFECTS flag
   for the CALL_EXPR, expand (emit) the expression, emit any assignment
   of the result to an IOSTAT= variable, and emit any checking of the
   result for errors.  */

static tree
ffeste_io_dolio_ (ffebld expr)
{
  tree type_id;
  tree num_elements;
  tree variable;
  tree size;
  tree arglist;
  ffeinfoBasictype bt;
  ffeinfoKindtype kt;
  int tc;

  bt = ffeinfo_basictype (ffebld_info (expr));
  kt = ffeinfo_kindtype (ffebld_info (expr));

  if ((bt == FFEINFO_basictypeANY)
      || (kt == FFEINFO_kindtypeANY))
    return error_mark_node;

  tc = ffecom_f2c_typecode (bt, kt);
  assert (tc != -1);
  type_id = build_int_2 (tc, 0);

  type_id
    = ffecom_1 (ADDR_EXPR, ffecom_f2c_ptr_to_ftnint_type_node,
		convert (ffecom_f2c_ftnint_type_node,
			 type_id));

  variable = ffecom_arg_ptr_to_expr (expr, &size);

  if ((type_id == error_mark_node)
      || (variable == error_mark_node)
      || (size == error_mark_node))
    return error_mark_node;

  if (size == NULL_TREE)	/* Already filled in for CHARACTER type. */
    {				/* "(ftnlen) sizeof(type)" */
      size = size_binop (CEIL_DIV_EXPR,
			 TYPE_SIZE_UNIT (ffecom_tree_type[bt][kt]),
			 size_int (TYPE_PRECISION (char_type_node)
				   / BITS_PER_UNIT));
#if 0	/* Assume that while it is possible that char * is wider than
	   ftnlen, no object in Fortran space can get big enough for its
	   size to be wider than ftnlen.  I really hope nobody wastes
	   time debugging a case where it can!  */
      assert (TYPE_PRECISION (ffecom_f2c_ftnlen_type_node)
	      >= TYPE_PRECISION (TREE_TYPE (size)));
#endif
      size = convert (ffecom_f2c_ftnlen_type_node, size);
    }

  if (ffeinfo_rank (ffebld_info (expr)) == 0
      || TREE_CODE (TREE_TYPE (TREE_TYPE (variable))) != ARRAY_TYPE)
    num_elements = ffecom_integer_one_node;
  else
    {
      num_elements
	= size_binop (CEIL_DIV_EXPR,
		      TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (variable))),
		      convert (sizetype, size));
      num_elements = size_binop (CEIL_DIV_EXPR, num_elements,
				 size_int (TYPE_PRECISION (char_type_node)
					   / BITS_PER_UNIT));
      num_elements = convert (ffecom_f2c_ftnlen_type_node,
			      num_elements);
    }

  num_elements
    = ffecom_1 (ADDR_EXPR, ffecom_f2c_ptr_to_ftnlen_type_node,
		num_elements);

  variable = convert (string_type_node, variable);

  arglist = build_tree_list (NULL_TREE, type_id);
  TREE_CHAIN (arglist) = build_tree_list (NULL_TREE, num_elements);
  TREE_CHAIN (TREE_CHAIN (arglist)) = build_tree_list (NULL_TREE, variable);
  TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist)))
    = build_tree_list (NULL_TREE, size);

  return ffecom_call_gfrt (FFECOM_gfrtDOLIO, arglist, NULL_TREE);
}

/* I/O driver for unformatted I/O item (do_uio)

   Returns a tree for a CALL_EXPR to the do_uio function, which handles
   an unformatted I/O list item, along with the appropriate arguments for
   the function.  It is up to the caller to set the TREE_SIDE_EFFECTS flag
   for the CALL_EXPR, expand (emit) the expression, emit any assignment
   of the result to an IOSTAT= variable, and emit any checking of the
   result for errors.  */

static tree
ffeste_io_douio_ (ffebld expr)
{
  tree num_elements;
  tree variable;
  tree size;
  tree arglist;
  ffeinfoBasictype bt;
  ffeinfoKindtype kt;
  bool is_complex;

  bt = ffeinfo_basictype (ffebld_info (expr));
  kt = ffeinfo_kindtype (ffebld_info (expr));

  if ((bt == FFEINFO_basictypeANY)
      || (kt == FFEINFO_kindtypeANY))
    return error_mark_node;

  if (bt == FFEINFO_basictypeCOMPLEX)
    {
      is_complex = TRUE;
      bt = FFEINFO_basictypeREAL;
    }
  else
    is_complex = FALSE;

  variable = ffecom_arg_ptr_to_expr (expr, &size);

  if ((variable == error_mark_node)
      || (size == error_mark_node))
    return error_mark_node;

  if (size == NULL_TREE)	/* Already filled in for CHARACTER type. */
    {				/* "(ftnlen) sizeof(type)" */
      size = size_binop (CEIL_DIV_EXPR,
			 TYPE_SIZE_UNIT (ffecom_tree_type[bt][kt]),
			 size_int (TYPE_PRECISION (char_type_node)
				   / BITS_PER_UNIT));
#if 0	/* Assume that while it is possible that char * is wider than
	   ftnlen, no object in Fortran space can get big enough for its
	   size to be wider than ftnlen.  I really hope nobody wastes
	   time debugging a case where it can!  */
      assert (TYPE_PRECISION (ffecom_f2c_ftnlen_type_node)
	      >= TYPE_PRECISION (TREE_TYPE (size)));
#endif
      size = convert (ffecom_f2c_ftnlen_type_node, size);
    }

  if (ffeinfo_rank (ffebld_info (expr)) == 0
      || TREE_CODE (TREE_TYPE (TREE_TYPE (variable))) != ARRAY_TYPE)
    num_elements
      = is_complex ? ffecom_f2c_ftnlen_two_node : ffecom_f2c_ftnlen_one_node;
  else
    {
      num_elements
	= size_binop (CEIL_DIV_EXPR,
		      TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (variable))),
		      convert (sizetype, size));
      num_elements = size_binop (CEIL_DIV_EXPR, num_elements,
				 size_int (TYPE_PRECISION (char_type_node)
					   / BITS_PER_UNIT));
      num_elements = convert (ffecom_f2c_ftnlen_type_node,
			      num_elements);
    }

  num_elements
    = ffecom_1 (ADDR_EXPR, ffecom_f2c_ptr_to_ftnlen_type_node,
		num_elements);

  variable = convert (string_type_node, variable);

  arglist = build_tree_list (NULL_TREE, num_elements);
  TREE_CHAIN (arglist) = build_tree_list (NULL_TREE, variable);
  TREE_CHAIN (TREE_CHAIN (arglist)) = build_tree_list (NULL_TREE, size);

  return ffecom_call_gfrt (FFECOM_gfrtDOUIO, arglist, NULL_TREE);
}

/* Make arglist with ptr to BACKSPACE/ENDFILE/REWIND control list.

   Returns a tree suitable as an argument list containing a pointer to
   a BACKSPACE/ENDFILE/REWIND control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_alist_struct;
static tree
ffeste_io_ialist_ (bool have_err,
		   ffestvUnit unit,
		   ffebld unit_expr,
		   int unit_dflt)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  bool constantp = TRUE;
  static tree errfield, unitfield;
  tree errinit, unitinit;
  tree unitexp;
  static int mynumber = 0;

  if (f2c_alist_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     ffecom_f2c_ftnint_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_alist_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);

  switch (unit)
    {
    case FFESTV_unitNONE:
    case FFESTV_unitASTERISK:
      unitinit = build_int_2 (unit_dflt, 0);
      unitexp = unitinit;
      break;

    case FFESTV_unitINTEXPR:
      unitexp = ffecom_const_expr (unit_expr);
      if (unitexp)
	unitinit = unitexp;
      else
	{
	  unitinit = ffecom_integer_zero_node;
	  constantp = FALSE;
	}
      break;

    default:
      assert ("bad unit spec" == NULL);
      unitinit = ffecom_integer_zero_node;
      unitexp = unitinit;
      break;
    }

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_alist_struct)), errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);

  inits = build_constructor (f2c_alist_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_alist_%d",
						  mynumber++),
		  f2c_alist_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  if (! unitexp)
    ffecom_prepare_expr (unit_expr);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  if (! unitexp)
    {
      unitexp = ffecom_expr (unit_expr);
      ffeste_f2c_compile_ (unitfield, unitexp);
    }

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Make arglist with ptr to external-I/O control list.

   Returns a tree suitable as an argument list containing a pointer to
   an external-I/O control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_cilist_struct;
static tree
ffeste_io_cilist_ (bool have_err,
		   ffestvUnit unit,
		   ffebld unit_expr,
		   int unit_dflt,
		   bool have_end,
		   ffestvFormat format,
		   ffestpFile *format_spec,
		   bool rec,
		   ffebld rec_expr)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  bool constantp = TRUE;
  static tree errfield, unitfield, endfield, formatfield, recfield;
  tree errinit, unitinit, endinit, formatinit, recinit;
  tree unitexp, formatexp, recexp;
  static int mynumber = 0;

  if (f2c_cilist_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     ffecom_f2c_ftnint_type_node);
      endfield = ffecom_decl_field (ref, unitfield, "end",
				    ffecom_f2c_flag_type_node);
      formatfield = ffecom_decl_field (ref, endfield, "format",
				       string_type_node);
      recfield = ffecom_decl_field (ref, formatfield, "rec",
				    ffecom_f2c_ftnint_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_cilist_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);

  switch (unit)
    {
    case FFESTV_unitNONE:
    case FFESTV_unitASTERISK:
      unitinit = build_int_2 (unit_dflt, 0);
      unitexp = unitinit;
      break;

    case FFESTV_unitINTEXPR:
      unitexp = ffecom_const_expr (unit_expr);
      if (unitexp)
	unitinit = unitexp;
      else
	{
	  unitinit = ffecom_integer_zero_node;
	  constantp = FALSE;
	}
      break;

    default:
      assert ("bad unit spec" == NULL);
      unitinit = ffecom_integer_zero_node;
      unitexp = unitinit;
      break;
    }

  switch (format)
    {
    case FFESTV_formatNONE:
      formatinit = null_pointer_node;
      formatexp = formatinit;
      break;

    case FFESTV_formatLABEL:
      formatexp = error_mark_node;
      formatinit = ffecom_lookup_label (format_spec->u.label);
      if ((formatinit == NULL_TREE)
	  || (TREE_CODE (formatinit) == ERROR_MARK))
	break;
      formatinit = ffecom_1 (ADDR_EXPR,
			     build_pointer_type (void_type_node),
			     formatinit);
      TREE_CONSTANT (formatinit) = 1;
      break;

    case FFESTV_formatCHAREXPR:
      formatexp = ffecom_arg_ptr_to_const_expr (format_spec->u.expr, NULL);
      if (formatexp)
	formatinit = formatexp;
      else
	{
	  formatinit = null_pointer_node;
	  constantp = FALSE;
	}
      break;

    case FFESTV_formatASTERISK:
      formatinit = null_pointer_node;
      formatexp = formatinit;
      break;

    case FFESTV_formatINTEXPR:
      formatinit = null_pointer_node;
      formatexp = ffecom_expr_assign (format_spec->u.expr);
      if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (formatexp)))
	  < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node))))
	error ("ASSIGNed FORMAT specifier is too small");
      formatexp = convert (string_type_node, formatexp);
      break;

    case FFESTV_formatNAMELIST:
      formatinit = ffecom_expr (format_spec->u.expr);
      formatexp = formatinit;
      break;

    default:
      assert ("bad format spec" == NULL);
      formatinit = integer_zero_node;
      formatexp = formatinit;
      break;
    }

  ffeste_f2c_init_flag_ (have_end, endinit);

  if (rec)
    recexp = ffecom_const_expr (rec_expr);
  else
    recexp = ffecom_integer_zero_node;
  if (recexp)
    recinit = recexp;
  else
    {
      recinit = ffecom_integer_zero_node;
      constantp = FALSE;
    }

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_cilist_struct)), errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);
  ffeste_f2c_init_next_ (endinit);
  ffeste_f2c_init_next_ (formatinit);
  ffeste_f2c_init_next_ (recinit);

  inits = build_constructor (f2c_cilist_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_cilist_%d",
						  mynumber++),
		  f2c_cilist_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  if (! unitexp)
    ffecom_prepare_expr (unit_expr);

  if (! formatexp)
    ffecom_prepare_arg_ptr_to_expr (format_spec->u.expr);

  if (! recexp)
    ffecom_prepare_expr (rec_expr);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  if (! unitexp)
    {
      unitexp = ffecom_expr (unit_expr);
      ffeste_f2c_compile_ (unitfield, unitexp);
    }

  if (! formatexp)
    {
      formatexp = ffecom_arg_ptr_to_expr (format_spec->u.expr, NULL);
      ffeste_f2c_compile_ (formatfield, formatexp);
    }
  else if (format == FFESTV_formatINTEXPR)
    ffeste_f2c_compile_ (formatfield, formatexp);

  if (! recexp)
    {
      recexp = ffecom_expr (rec_expr);
      ffeste_f2c_compile_ (recfield, recexp);
    }

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Make arglist with ptr to CLOSE control list.

   Returns a tree suitable as an argument list containing a pointer to
   a CLOSE-statement control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_close_struct;
static tree
ffeste_io_cllist_ (bool have_err,
		   ffebld unit_expr,
		   ffestpFile *stat_spec)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  tree ignore;			/* Ignore length info for certain fields. */
  bool constantp = TRUE;
  static tree errfield, unitfield, statfield;
  tree errinit, unitinit, statinit;
  tree unitexp, statexp;
  static int mynumber = 0;

  if (f2c_close_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     ffecom_f2c_ftnint_type_node);
      statfield = ffecom_decl_field (ref, unitfield, "stat",
				     string_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_close_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);

  unitexp = ffecom_const_expr (unit_expr);
  if (unitexp)
    unitinit = unitexp;
  else
    {
      unitinit = ffecom_integer_zero_node;
      constantp = FALSE;
    }

  ffeste_f2c_init_charnolen_ (statexp, statinit, stat_spec);

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_close_struct)), errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);
  ffeste_f2c_init_next_ (statinit);

  inits = build_constructor (f2c_close_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_cllist_%d",
						  mynumber++),
		  f2c_close_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  if (! unitexp)
    ffecom_prepare_expr (unit_expr);

  if (! statexp)
    ffecom_prepare_arg_ptr_to_expr (stat_spec->u.expr);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  if (! unitexp)
    {
      unitexp = ffecom_expr (unit_expr);
      ffeste_f2c_compile_ (unitfield, unitexp);
    }

  ffeste_f2c_compile_charnolen_ (statfield, stat_spec, statexp);

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Make arglist with ptr to internal-I/O control list.

   Returns a tree suitable as an argument list containing a pointer to
   an internal-I/O control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_icilist_struct;
static tree
ffeste_io_icilist_ (bool have_err,
		    ffebld unit_expr,
		    bool have_end,
		    ffestvFormat format,
		    ffestpFile *format_spec)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  bool constantp = TRUE;
  static tree errfield, unitfield, endfield, formatfield, unitlenfield,
    unitnumfield;
  tree errinit, unitinit, endinit, formatinit, unitleninit, unitnuminit;
  tree unitexp, formatexp, unitlenexp, unitnumexp;
  static int mynumber = 0;

  if (f2c_icilist_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     string_type_node);
      endfield = ffecom_decl_field (ref, unitfield, "end",
				    ffecom_f2c_flag_type_node);
      formatfield = ffecom_decl_field (ref, endfield, "format",
				       string_type_node);
      unitlenfield = ffecom_decl_field (ref, formatfield, "unitlen",
					ffecom_f2c_ftnint_type_node);
      unitnumfield = ffecom_decl_field (ref, unitlenfield, "unitnum",
					ffecom_f2c_ftnint_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_icilist_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);

  unitexp = ffecom_arg_ptr_to_const_expr (unit_expr, &unitlenexp);
  if (unitexp)
    unitinit = unitexp;
  else
    {
      unitinit = null_pointer_node;
      constantp = FALSE;
    }
  if (unitlenexp)
    unitleninit = unitlenexp;
  else
    {
      unitleninit = ffecom_integer_zero_node;
      constantp = FALSE;
    }

  /* Now see if we can fully initialize the number of elements, or
     if we have to compute that at run time.  */
  if (ffeinfo_rank (ffebld_info (unit_expr)) == 0
      || (unitexp
	  && TREE_CODE (TREE_TYPE (TREE_TYPE (unitexp))) != ARRAY_TYPE))
    {
      /* Not an array, so just one element.  */
      unitnuminit = ffecom_integer_one_node;
      unitnumexp = unitnuminit;
    }
  else if (unitexp && unitlenexp)
    {
      /* An array, but all the info is constant, so compute now.  */
      unitnuminit
	= size_binop (CEIL_DIV_EXPR,
		      TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (unitexp))),
		      convert (sizetype, unitlenexp));
      unitnuminit = size_binop (CEIL_DIV_EXPR, unitnuminit,
				size_int (TYPE_PRECISION (char_type_node)
					  / BITS_PER_UNIT));
      unitnumexp = unitnuminit;
    }
  else
    {
      /* Put off computing until run time.  */
      unitnuminit = ffecom_integer_zero_node;
      unitnumexp = NULL_TREE;
      constantp = FALSE;
    }

  switch (format)
    {
    case FFESTV_formatNONE:
      formatinit = null_pointer_node;
      formatexp = formatinit;
      break;

    case FFESTV_formatLABEL:
      formatexp = error_mark_node;
      formatinit = ffecom_lookup_label (format_spec->u.label);
      if ((formatinit == NULL_TREE)
	  || (TREE_CODE (formatinit) == ERROR_MARK))
	break;
      formatinit = ffecom_1 (ADDR_EXPR,
			     build_pointer_type (void_type_node),
			     formatinit);
      TREE_CONSTANT (formatinit) = 1;
      break;

    case FFESTV_formatCHAREXPR:
      ffeste_f2c_init_format_ (formatexp, formatinit, format_spec);
      break;

    case FFESTV_formatASTERISK:
      formatinit = null_pointer_node;
      formatexp = formatinit;
      break;

    case FFESTV_formatINTEXPR:
      formatinit = null_pointer_node;
      formatexp = ffecom_expr_assign (format_spec->u.expr);
      if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (formatexp)))
	  < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node))))
	error ("ASSIGNed FORMAT specifier is too small");
      formatexp = convert (string_type_node, formatexp);
      break;

    default:
      assert ("bad format spec" == NULL);
      formatinit = ffecom_integer_zero_node;
      formatexp = formatinit;
      break;
    }

  ffeste_f2c_init_flag_ (have_end, endinit);

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_icilist_struct)),
			   errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);
  ffeste_f2c_init_next_ (endinit);
  ffeste_f2c_init_next_ (formatinit);
  ffeste_f2c_init_next_ (unitleninit);
  ffeste_f2c_init_next_ (unitnuminit);

  inits = build_constructor (f2c_icilist_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_icilist_%d",
						  mynumber++),
		  f2c_icilist_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  if (! unitexp)
    ffecom_prepare_arg_ptr_to_expr (unit_expr);

  ffeste_f2c_prepare_format_ (format_spec, formatexp);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  if (! unitexp || ! unitlenexp)
    {
      int need_unitexp = (! unitexp);
      int need_unitlenexp = (! unitlenexp);

      unitexp = ffecom_arg_ptr_to_expr (unit_expr, &unitlenexp);
      if (need_unitexp)
	ffeste_f2c_compile_ (unitfield, unitexp);
      if (need_unitlenexp)
	ffeste_f2c_compile_ (unitlenfield, unitlenexp);
    }

  if (! unitnumexp
      && unitexp != error_mark_node
      && unitlenexp != error_mark_node)
    {
      unitnumexp
	= size_binop (CEIL_DIV_EXPR,
		      TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (unitexp))),
		      convert (sizetype, unitlenexp));
      unitnumexp = size_binop (CEIL_DIV_EXPR, unitnumexp,
			       size_int (TYPE_PRECISION (char_type_node)
					 / BITS_PER_UNIT));
      ffeste_f2c_compile_ (unitnumfield, unitnumexp);
    }

  if (format == FFESTV_formatINTEXPR)
    ffeste_f2c_compile_ (formatfield, formatexp);
  else
    ffeste_f2c_compile_format_ (formatfield, format_spec, formatexp);

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Make arglist with ptr to INQUIRE control list

   Returns a tree suitable as an argument list containing a pointer to
   an INQUIRE-statement control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_inquire_struct;
static tree
ffeste_io_inlist_ (bool have_err,
		   ffestpFile *unit_spec,
		   ffestpFile *file_spec,
		   ffestpFile *exist_spec,
		   ffestpFile *open_spec,
		   ffestpFile *number_spec,
		   ffestpFile *named_spec,
		   ffestpFile *name_spec,
		   ffestpFile *access_spec,
		   ffestpFile *sequential_spec,
		   ffestpFile *direct_spec,
		   ffestpFile *form_spec,
		   ffestpFile *formatted_spec,
		   ffestpFile *unformatted_spec,
		   ffestpFile *recl_spec,
		   ffestpFile *nextrec_spec,
		   ffestpFile *blank_spec)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  bool constantp = TRUE;
  static tree errfield, unitfield, filefield, filelenfield, existfield,
    openfield, numberfield, namedfield, namefield, namelenfield, accessfield,
    accesslenfield, sequentialfield, sequentiallenfield, directfield, directlenfield,
    formfield, formlenfield, formattedfield, formattedlenfield, unformattedfield,
    unformattedlenfield, reclfield, nextrecfield, blankfield, blanklenfield;
  tree errinit, unitinit, fileinit, fileleninit, existinit, openinit, numberinit,
    namedinit, nameinit, nameleninit, accessinit, accessleninit, sequentialinit,
    sequentialleninit, directinit, directleninit, forminit, formleninit,
    formattedinit, formattedleninit, unformattedinit, unformattedleninit,
    reclinit, nextrecinit, blankinit, blankleninit;
  tree
    unitexp, fileexp, filelenexp, existexp, openexp, numberexp, namedexp,
    nameexp, namelenexp, accessexp, accesslenexp, sequentialexp, sequentiallenexp,
    directexp, directlenexp, formexp, formlenexp, formattedexp, formattedlenexp,
    unformattedexp, unformattedlenexp, reclexp, nextrecexp, blankexp, blanklenexp;
  static int mynumber = 0;

  if (f2c_inquire_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     ffecom_f2c_ftnint_type_node);
      filefield = ffecom_decl_field (ref, unitfield, "file",
				     string_type_node);
      filelenfield = ffecom_decl_field (ref, filefield, "filelen",
					ffecom_f2c_ftnlen_type_node);
      existfield = ffecom_decl_field (ref, filelenfield, "exist",
				      ffecom_f2c_ptr_to_ftnint_type_node);
      openfield = ffecom_decl_field (ref, existfield, "open",
				     ffecom_f2c_ptr_to_ftnint_type_node);
      numberfield = ffecom_decl_field (ref, openfield, "number",
				       ffecom_f2c_ptr_to_ftnint_type_node);
      namedfield = ffecom_decl_field (ref, numberfield, "named",
				      ffecom_f2c_ptr_to_ftnint_type_node);
      namefield = ffecom_decl_field (ref, namedfield, "name",
				     string_type_node);
      namelenfield = ffecom_decl_field (ref, namefield, "namelen",
					ffecom_f2c_ftnlen_type_node);
      accessfield = ffecom_decl_field (ref, namelenfield, "access",
				       string_type_node);
      accesslenfield = ffecom_decl_field (ref, accessfield, "accesslen",
					  ffecom_f2c_ftnlen_type_node);
      sequentialfield = ffecom_decl_field (ref, accesslenfield, "sequential",
					   string_type_node);
      sequentiallenfield = ffecom_decl_field (ref, sequentialfield,
					      "sequentiallen",
					      ffecom_f2c_ftnlen_type_node);
      directfield = ffecom_decl_field (ref, sequentiallenfield, "direct",
				       string_type_node);
      directlenfield = ffecom_decl_field (ref, directfield, "directlen",
					  ffecom_f2c_ftnlen_type_node);
      formfield = ffecom_decl_field (ref, directlenfield, "form",
				     string_type_node);
      formlenfield = ffecom_decl_field (ref, formfield, "formlen",
					ffecom_f2c_ftnlen_type_node);
      formattedfield = ffecom_decl_field (ref, formlenfield, "formatted",
					  string_type_node);
      formattedlenfield = ffecom_decl_field (ref, formattedfield,
					     "formattedlen",
					     ffecom_f2c_ftnlen_type_node);
      unformattedfield = ffecom_decl_field (ref, formattedlenfield,
					    "unformatted",
					    string_type_node);
      unformattedlenfield = ffecom_decl_field (ref, unformattedfield,
					       "unformattedlen",
					       ffecom_f2c_ftnlen_type_node);
      reclfield = ffecom_decl_field (ref, unformattedlenfield, "recl",
				     ffecom_f2c_ptr_to_ftnint_type_node);
      nextrecfield = ffecom_decl_field (ref, reclfield, "nextrec",
					ffecom_f2c_ptr_to_ftnint_type_node);
      blankfield = ffecom_decl_field (ref, nextrecfield, "blank",
				      string_type_node);
      blanklenfield = ffecom_decl_field (ref, blankfield, "blanklen",
					 ffecom_f2c_ftnlen_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_inquire_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);
  ffeste_f2c_init_int_ (unitexp, unitinit, unit_spec);
  ffeste_f2c_init_char_ (fileexp, fileinit, filelenexp, fileleninit,
			 file_spec);
  ffeste_f2c_init_ptrtoint_ (existexp, existinit, exist_spec);
  ffeste_f2c_init_ptrtoint_ (openexp, openinit, open_spec);
  ffeste_f2c_init_ptrtoint_ (numberexp, numberinit, number_spec);
  ffeste_f2c_init_ptrtoint_ (namedexp, namedinit, named_spec);
  ffeste_f2c_init_char_ (nameexp, nameinit, namelenexp, nameleninit,
			 name_spec);
  ffeste_f2c_init_char_ (accessexp, accessinit, accesslenexp,
			 accessleninit, access_spec);
  ffeste_f2c_init_char_ (sequentialexp, sequentialinit, sequentiallenexp,
			 sequentialleninit, sequential_spec);
  ffeste_f2c_init_char_ (directexp, directinit, directlenexp,
			 directleninit, direct_spec);
  ffeste_f2c_init_char_ (formexp, forminit, formlenexp, formleninit,
			 form_spec);
  ffeste_f2c_init_char_ (formattedexp, formattedinit,
			 formattedlenexp, formattedleninit, formatted_spec);
  ffeste_f2c_init_char_ (unformattedexp, unformattedinit, unformattedlenexp,
			 unformattedleninit, unformatted_spec);
  ffeste_f2c_init_ptrtoint_ (reclexp, reclinit, recl_spec);
  ffeste_f2c_init_ptrtoint_ (nextrecexp, nextrecinit, nextrec_spec);
  ffeste_f2c_init_char_ (blankexp, blankinit, blanklenexp,
			 blankleninit, blank_spec);

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_inquire_struct)),
			   errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);
  ffeste_f2c_init_next_ (fileinit);
  ffeste_f2c_init_next_ (fileleninit);
  ffeste_f2c_init_next_ (existinit);
  ffeste_f2c_init_next_ (openinit);
  ffeste_f2c_init_next_ (numberinit);
  ffeste_f2c_init_next_ (namedinit);
  ffeste_f2c_init_next_ (nameinit);
  ffeste_f2c_init_next_ (nameleninit);
  ffeste_f2c_init_next_ (accessinit);
  ffeste_f2c_init_next_ (accessleninit);
  ffeste_f2c_init_next_ (sequentialinit);
  ffeste_f2c_init_next_ (sequentialleninit);
  ffeste_f2c_init_next_ (directinit);
  ffeste_f2c_init_next_ (directleninit);
  ffeste_f2c_init_next_ (forminit);
  ffeste_f2c_init_next_ (formleninit);
  ffeste_f2c_init_next_ (formattedinit);
  ffeste_f2c_init_next_ (formattedleninit);
  ffeste_f2c_init_next_ (unformattedinit);
  ffeste_f2c_init_next_ (unformattedleninit);
  ffeste_f2c_init_next_ (reclinit);
  ffeste_f2c_init_next_ (nextrecinit);
  ffeste_f2c_init_next_ (blankinit);
  ffeste_f2c_init_next_ (blankleninit);

  inits = build_constructor (f2c_inquire_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_inlist_%d",
						  mynumber++),
		  f2c_inquire_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  ffeste_f2c_prepare_int_ (unit_spec, unitexp);
  ffeste_f2c_prepare_char_ (file_spec, fileexp);
  ffeste_f2c_prepare_ptrtoint_ (exist_spec, existexp);
  ffeste_f2c_prepare_ptrtoint_ (open_spec, openexp);
  ffeste_f2c_prepare_ptrtoint_ (number_spec, numberexp);
  ffeste_f2c_prepare_ptrtoint_ (named_spec, namedexp);
  ffeste_f2c_prepare_char_ (name_spec, nameexp);
  ffeste_f2c_prepare_char_ (access_spec, accessexp);
  ffeste_f2c_prepare_char_ (sequential_spec, sequentialexp);
  ffeste_f2c_prepare_char_ (direct_spec, directexp);
  ffeste_f2c_prepare_char_ (form_spec, formexp);
  ffeste_f2c_prepare_char_ (formatted_spec, formattedexp);
  ffeste_f2c_prepare_char_ (unformatted_spec, unformattedexp);
  ffeste_f2c_prepare_ptrtoint_ (recl_spec, reclexp);
  ffeste_f2c_prepare_ptrtoint_ (nextrec_spec, nextrecexp);
  ffeste_f2c_prepare_char_ (blank_spec, blankexp);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  ffeste_f2c_compile_int_ (unitfield, unit_spec, unitexp);
  ffeste_f2c_compile_char_ (filefield, filelenfield, file_spec,
			    fileexp, filelenexp);
  ffeste_f2c_compile_ptrtoint_ (existfield, exist_spec, existexp);
  ffeste_f2c_compile_ptrtoint_ (openfield, open_spec, openexp);
  ffeste_f2c_compile_ptrtoint_ (numberfield, number_spec, numberexp);
  ffeste_f2c_compile_ptrtoint_ (namedfield, named_spec, namedexp);
  ffeste_f2c_compile_char_ (namefield, namelenfield, name_spec, nameexp,
			    namelenexp);
  ffeste_f2c_compile_char_ (accessfield, accesslenfield, access_spec,
			    accessexp, accesslenexp);
  ffeste_f2c_compile_char_ (sequentialfield, sequentiallenfield,
			    sequential_spec, sequentialexp,
			    sequentiallenexp);
  ffeste_f2c_compile_char_ (directfield, directlenfield, direct_spec,
			    directexp, directlenexp);
  ffeste_f2c_compile_char_ (formfield, formlenfield, form_spec, formexp,
			    formlenexp);
  ffeste_f2c_compile_char_ (formattedfield, formattedlenfield, formatted_spec,
			    formattedexp, formattedlenexp);
  ffeste_f2c_compile_char_ (unformattedfield, unformattedlenfield,
			    unformatted_spec, unformattedexp,
			    unformattedlenexp);
  ffeste_f2c_compile_ptrtoint_ (reclfield, recl_spec, reclexp);
  ffeste_f2c_compile_ptrtoint_ (nextrecfield, nextrec_spec, nextrecexp);
  ffeste_f2c_compile_char_ (blankfield, blanklenfield, blank_spec, blankexp,
			    blanklenexp);

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Make arglist with ptr to OPEN control list

   Returns a tree suitable as an argument list containing a pointer to
   an OPEN-statement control list.  First, generates that control
   list, if necessary, along with any static and run-time initializations
   that are needed as specified by the arguments to this function.

   Must ensure that all expressions are prepared before being evaluated,
   for any whose evaluation might result in the generation of temporaries.

   Note that this means this function causes a transition, within the
   current block being code-generated via the back end, from the
   declaration of variables (temporaries) to the expanding of expressions,
   statements, etc.  */

static GTY(()) tree f2c_open_struct;
static tree
ffeste_io_olist_ (bool have_err,
		  ffebld unit_expr,
		  ffestpFile *file_spec,
		  ffestpFile *stat_spec,
		  ffestpFile *access_spec,
		  ffestpFile *form_spec,
		  ffestpFile *recl_spec,
		  ffestpFile *blank_spec)
{
  tree t;
  tree ttype;
  tree field;
  tree inits, initn;
  tree ignore;			/* Ignore length info for certain fields. */
  bool constantp = TRUE;
  static tree errfield, unitfield, filefield, filelenfield, statfield,
    accessfield, formfield, reclfield, blankfield;
  tree errinit, unitinit, fileinit, fileleninit, statinit, accessinit,
    forminit, reclinit, blankinit;
  tree
    unitexp, fileexp, filelenexp, statexp, accessexp, formexp, reclexp,
    blankexp;
  static int mynumber = 0;

  if (f2c_open_struct == NULL_TREE)
    {
      tree ref;

      ref = make_node (RECORD_TYPE);

      errfield = ffecom_decl_field (ref, NULL_TREE, "err",
				    ffecom_f2c_flag_type_node);
      unitfield = ffecom_decl_field (ref, errfield, "unit",
				     ffecom_f2c_ftnint_type_node);
      filefield = ffecom_decl_field (ref, unitfield, "file",
				     string_type_node);
      filelenfield = ffecom_decl_field (ref, filefield, "filelen",
					ffecom_f2c_ftnlen_type_node);
      statfield = ffecom_decl_field (ref, filelenfield, "stat",
				     string_type_node);
      accessfield = ffecom_decl_field (ref, statfield, "access",
				       string_type_node);
      formfield = ffecom_decl_field (ref, accessfield, "form",
				     string_type_node);
      reclfield = ffecom_decl_field (ref, formfield, "recl",
				     ffecom_f2c_ftnint_type_node);
      blankfield = ffecom_decl_field (ref, reclfield, "blank",
				      string_type_node);

      TYPE_FIELDS (ref) = errfield;
      layout_type (ref);

      f2c_open_struct = ref;
    }

  /* Try to do as much compile-time initialization of the structure
     as possible, to save run time.  */

  ffeste_f2c_init_flag_ (have_err, errinit);

  unitexp = ffecom_const_expr (unit_expr);
  if (unitexp)
    unitinit = unitexp;
  else
    {
      unitinit = ffecom_integer_zero_node;
      constantp = FALSE;
    }

  ffeste_f2c_init_char_ (fileexp, fileinit, filelenexp, fileleninit,
			 file_spec);
  ffeste_f2c_init_charnolen_ (statexp, statinit, stat_spec);
  ffeste_f2c_init_charnolen_ (accessexp, accessinit, access_spec);
  ffeste_f2c_init_charnolen_ (formexp, forminit, form_spec);
  ffeste_f2c_init_int_ (reclexp, reclinit, recl_spec);
  ffeste_f2c_init_charnolen_ (blankexp, blankinit, blank_spec);

  inits = build_tree_list ((field = TYPE_FIELDS (f2c_open_struct)), errinit);
  initn = inits;
  ffeste_f2c_init_next_ (unitinit);
  ffeste_f2c_init_next_ (fileinit);
  ffeste_f2c_init_next_ (fileleninit);
  ffeste_f2c_init_next_ (statinit);
  ffeste_f2c_init_next_ (accessinit);
  ffeste_f2c_init_next_ (forminit);
  ffeste_f2c_init_next_ (reclinit);
  ffeste_f2c_init_next_ (blankinit);

  inits = build_constructor (f2c_open_struct, inits);
  TREE_CONSTANT (inits) = constantp ? 1 : 0;
  TREE_STATIC (inits) = 1;

  t = build_decl (VAR_DECL,
		  ffecom_get_invented_identifier ("__g77_olist_%d",
						  mynumber++),
		  f2c_open_struct);
  TREE_STATIC (t) = 1;
  t = ffecom_start_decl (t, 1);
  ffecom_finish_decl (t, inits, 0);

  /* Prepare run-time expressions.  */

  if (! unitexp)
    ffecom_prepare_expr (unit_expr);

  ffeste_f2c_prepare_char_ (file_spec, fileexp);
  ffeste_f2c_prepare_charnolen_ (stat_spec, statexp);
  ffeste_f2c_prepare_charnolen_ (access_spec, accessexp);
  ffeste_f2c_prepare_charnolen_ (form_spec, formexp);
  ffeste_f2c_prepare_int_ (recl_spec, reclexp);
  ffeste_f2c_prepare_charnolen_ (blank_spec, blankexp);

  ffecom_prepare_end ();

  /* Now evaluate run-time expressions as needed.  */

  if (! unitexp)
    {
      unitexp = ffecom_expr (unit_expr);
      ffeste_f2c_compile_ (unitfield, unitexp);
    }

  ffeste_f2c_compile_char_ (filefield, filelenfield, file_spec, fileexp,
			    filelenexp);
  ffeste_f2c_compile_charnolen_ (statfield, stat_spec, statexp);
  ffeste_f2c_compile_charnolen_ (accessfield, access_spec, accessexp);
  ffeste_f2c_compile_charnolen_ (formfield, form_spec, formexp);
  ffeste_f2c_compile_int_ (reclfield, recl_spec, reclexp);
  ffeste_f2c_compile_charnolen_ (blankfield, blank_spec, blankexp);

  ttype = build_pointer_type (TREE_TYPE (t));
  t = ffecom_1 (ADDR_EXPR, ttype, t);

  t = build_tree_list (NULL_TREE, t);

  return t;
}

/* Generate code for BACKSPACE/ENDFILE/REWIND.  */

static void
ffeste_subr_beru_ (ffestpBeruStmt *info, ffecomGfrt rt)
{
  tree alist;
  bool iostat;
  bool errl;

  ffeste_emit_line_note_ ();

#define specified(something) (info->beru_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_beruixIOSTAT);
  errl = specified (FFESTP_beruixERR);

#undef specified

  /* ~~For now, we assume the unit number is specified and is not ASTERISK,
     because the FFE doesn't support BACKSPACE(*) and rejects a BACKSPACE
     without any unit specifier.  f2c, however, supports the former
     construct.	 When it is time to add this feature to the FFE, which
     probably is fairly easy, ffestc_R919 and company will want to pass an
     ffestvUnit indicator of FFESTV_unitINTEXPR or _unitASTERISK to
     ffeste_R919 and company, and they will want to pass that same value to
     this function, and that argument will replace the constant _unitINTEXPR_
     in the call below.	 Right now, the default unit number, 6, is ignored.  */

  ffeste_start_stmt_ ();

  if (errl)
    {
      /* Have ERR= specification.   */

      ffeste_io_err_
	= ffeste_io_abort_
	= ffecom_lookup_label
	(info->beru_spec[FFESTP_beruixERR].u.label);
      ffeste_io_abort_is_temp_ = FALSE;
    }
  else
    {
      /* No ERR= specification.  */

      ffeste_io_err_ = NULL_TREE;

      if ((ffeste_io_abort_is_temp_ = iostat))
	ffeste_io_abort_ = ffecom_temp_label ();
      else
	ffeste_io_abort_ = NULL_TREE;
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = ffecom_expr
	(info->beru_spec[FFESTP_beruixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("beru", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT= or ERR= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  alist = ffeste_io_ialist_ (errl || iostat, FFESTV_unitINTEXPR,
			     info->beru_spec[FFESTP_beruixUNIT].u.expr, 6);

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
     label, since we're gonna fall through to there anyway. */

  ffeste_io_call_ (ffecom_call_gfrt (rt, alist, NULL_TREE),
		   ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here. */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      assert (ffeste_io_err_ == NULL_TREE);
    }

  ffeste_end_stmt_ ();
}

/* END DO statement

   Also invoked by _labeldef_branch_finish_ (or, in cases
   of errors, other _labeldef_ functions) when the label definition is
   for a DO-target (LOOPEND) label, once per matching/outstanding DO
   block on the stack.  */

void
ffeste_do (ffestw block)
{
  ffeste_emit_line_note_ ();

  if (ffestw_do_tvar (block) == 0)
    {
      expand_end_loop ();		/* DO WHILE and just DO. */

      ffeste_end_block_ (block);
    }
  else
    ffeste_end_iterdo_ (block,
			ffestw_do_tvar (block),
			ffestw_do_incr_saved (block),
			ffestw_do_count_var (block));
}

/* End of statement following logical IF.

   Applies to *only* logical IF, not to IF-THEN.  */

void
ffeste_end_R807 (void)
{
  ffeste_emit_line_note_ ();

  expand_end_cond ();

  ffeste_end_block_ (NULL);
}

/* Generate "code" for branch label definition.  */

void
ffeste_labeldef_branch (ffelab label)
{
  tree glabel;

  glabel = ffecom_lookup_label (label);
  assert (glabel != NULL_TREE);
  if (TREE_CODE (glabel) == ERROR_MARK)
    return;

  assert (DECL_INITIAL (glabel) == NULL_TREE);

  DECL_INITIAL (glabel) = error_mark_node;
  DECL_SOURCE_FILE (glabel) = ffelab_definition_filename (label);
  DECL_SOURCE_LINE (glabel) = ffelab_definition_filelinenum (label);

  emit_nop ();

  expand_label (glabel);
}

/* Generate "code" for FORMAT label definition.  */

void
ffeste_labeldef_format (ffelab label)
{
  ffeste_label_formatdef_ = label;
}

/* Assignment statement (outside of WHERE).  */

void
ffeste_R737A (ffebld dest, ffebld source)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_stmt_ ();

  ffecom_expand_let_stmt (dest, source);

  ffeste_end_stmt_ ();
}

/* Block IF (IF-THEN) statement.  */

void
ffeste_R803 (ffestw block, ffebld expr)
{
  tree temp;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_block_ (block);

  temp = ffecom_make_tempvar ("ifthen", integer_type_node,
			      FFETARGET_charactersizeNONE, -1);

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (expr);

  if (ffecom_prepare_end ())
    {
      tree result;

      result = ffecom_modify (void_type_node,
			      temp,
			      ffecom_truth_value (ffecom_expr (expr)));

      expand_expr_stmt (result);

      ffeste_end_stmt_ ();
    }
  else
    {
      ffeste_end_stmt_ ();

      temp = ffecom_truth_value (ffecom_expr (expr));
    }

  expand_start_cond (temp, 0);

  /* No fake `else' constructs introduced (yet).  */
  ffestw_set_ifthen_fake_else (block, 0);
}

/* ELSE IF statement.  */

void
ffeste_R804 (ffestw block, ffebld expr)
{
  tree temp;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  /* Since ELSEIF(expr) might require preparations for expr,
     implement as ELSE; prepare-expr; IF (expr) THEN ...; ENDIF.  */

  expand_start_else ();

  ffeste_start_block_ (block);

  temp = ffecom_make_tempvar ("elseif", integer_type_node,
			      FFETARGET_charactersizeNONE, -1);

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (expr);

  if (ffecom_prepare_end ())
    {
      tree result;

      result = ffecom_modify (void_type_node,
			      temp,
			      ffecom_truth_value (ffecom_expr (expr)));

      expand_expr_stmt (result);

      ffeste_end_stmt_ ();
    }
  else
    {
      /* In this case, we could probably have used expand_start_elseif
	 instead, saving the need for a fake `else' construct.  But,
	 until it's clear that'd improve performance, it's easier this
	 way, since we have to expand_start_else before we get to this
	 test, given the current design.  */

      ffeste_end_stmt_ ();

      temp = ffecom_truth_value (ffecom_expr (expr));
    }

  expand_start_cond (temp, 0);

  /* Increment number of fake `else' constructs introduced.  */
  ffestw_set_ifthen_fake_else (block,
			       ffestw_ifthen_fake_else (block) + 1);
}

/* ELSE statement.  */

void
ffeste_R805 (ffestw block UNUSED)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  expand_start_else ();
}

/* END IF statement.  */

void
ffeste_R806 (ffestw block)
{
  int i = ffestw_ifthen_fake_else (block) + 1;

  ffeste_emit_line_note_ ();

  for (; i; --i)
    {
      expand_end_cond ();

      ffeste_end_block_ (block);
    }
}

/* Logical IF statement.  */

void
ffeste_R807 (ffebld expr)
{
  tree temp;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_block_ (NULL);

  temp = ffecom_make_tempvar ("if", integer_type_node,
			      FFETARGET_charactersizeNONE, -1);

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (expr);

  if (ffecom_prepare_end ())
    {
      tree result;

      result = ffecom_modify (void_type_node,
			      temp,
			      ffecom_truth_value (ffecom_expr (expr)));

      expand_expr_stmt (result);

      ffeste_end_stmt_ ();
    }
  else
    {
      ffeste_end_stmt_ ();

      temp = ffecom_truth_value (ffecom_expr (expr));
    }

  expand_start_cond (temp, 0);
}

/* SELECT CASE statement.  */

void
ffeste_R809 (ffestw block, ffebld expr)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_block_ (block);

  if ((expr == NULL)
      || (ffeinfo_basictype (ffebld_info (expr))
	  == FFEINFO_basictypeANY))
    ffestw_set_select_texpr (block, error_mark_node);
  else if (ffeinfo_basictype (ffebld_info (expr))
	   == FFEINFO_basictypeCHARACTER)
    {
      /* ~~~Someday handle CHARACTER*1, CHARACTER*N */

      /* xgettext:no-c-format */
      ffebad_start_msg ("SELECT CASE on CHARACTER type (at %0) not supported -- sorry",
			FFEBAD_severityFATAL);
      ffebad_here (0, ffestw_line (block), ffestw_col (block));
      ffebad_finish ();
      ffestw_set_select_texpr (block, error_mark_node);
    }
  else
    {
      tree result;
      tree texpr;

      result = ffecom_make_tempvar ("select", ffecom_type_expr (expr),
				    ffeinfo_size (ffebld_info (expr)),
				    -1);

      ffeste_start_stmt_ ();

      ffecom_prepare_expr (expr);

      ffecom_prepare_end ();

      texpr = ffecom_expr (expr);

      assert (TYPE_MAIN_VARIANT (TREE_TYPE (texpr))
	      == TYPE_MAIN_VARIANT (TREE_TYPE (result)));

      texpr = ffecom_modify (void_type_node,
			     result,
			     texpr);
      expand_expr_stmt (texpr);

      ffeste_end_stmt_ ();

      expand_start_case (1, result, TREE_TYPE (result),
			 "SELECT CASE statement");
      ffestw_set_select_texpr (block, texpr);
      ffestw_set_select_break (block, FALSE);
    }
}

/* CASE statement.

   If casenum is 0, it's CASE DEFAULT.	Else it's the case ranges at
   the start of the first_stmt list in the select object at the top of
   the stack that match casenum.  */

void
ffeste_R810 (ffestw block, unsigned long casenum)
{
  ffestwSelect s = ffestw_select (block);
  ffestwCase c;
  tree texprlow;
  tree texprhigh;
  tree tlabel;
  int pushok;
  tree duplicate;

  ffeste_check_simple_ ();

  if (s->first_stmt == (ffestwCase) &s->first_rel)
    c = NULL;
  else
    c = s->first_stmt;

  ffeste_emit_line_note_ ();

  if (ffestw_select_texpr (block) == error_mark_node)
    return;

  /* ~~~Someday handle CHARACTER*1, CHARACTER*N */

  tlabel = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);

  if (ffestw_select_break (block))
    expand_exit_something ();
  else
    ffestw_set_select_break (block, TRUE);

  if ((c == NULL) || (casenum != c->casenum))
    {
      if (casenum == 0)	/* Intentional CASE DEFAULT. */
	{
	  pushok = pushcase (NULL_TREE, 0, tlabel, &duplicate);
	  assert (pushok == 0);
	}
    }
  else
    do
      {
	texprlow = (c->low == NULL) ? NULL_TREE
	  : ffecom_constantunion_with_type (&ffebld_constant_union (c->low),
				  ffecom_tree_type[s->type][s->kindtype],c->low->consttype);
	if (c->low != c->high)
	  {
	    texprhigh = (c->high == NULL) ? NULL_TREE
	      : ffecom_constantunion_with_type (&ffebld_constant_union (c->high),
				      ffecom_tree_type[s->type][s->kindtype],c->high->consttype);
	    pushok = pushcase_range (texprlow, texprhigh, convert,
				     tlabel, &duplicate);
	  }
	else
	  pushok = pushcase (texprlow, convert, tlabel, &duplicate);
	if (pushok == 2)
	  {
	    ffebad_start_msg ("SELECT (at %0) has duplicate cases -- check integer overflow of CASE(s)",
	      FFEBAD_severityFATAL);
	    ffebad_here (0, ffestw_line (block), ffestw_col (block));
	    ffebad_finish ();
	    ffestw_set_select_texpr (block, error_mark_node);
	  }
	c = c->next_stmt;
	/* Unlink prev.  */
	c->previous_stmt->previous_stmt->next_stmt = c;
	c->previous_stmt = c->previous_stmt->previous_stmt;
      }
    while ((c != (ffestwCase) &s->first_rel) && (casenum == c->casenum));
}

/* END SELECT statement.  */

void
ffeste_R811 (ffestw block)
{
  ffeste_emit_line_note_ ();

  /* ~~~Someday handle CHARACTER*1, CHARACTER*N */

  if (TREE_CODE (ffestw_select_texpr (block)) != ERROR_MARK)
    expand_end_case (ffestw_select_texpr (block));

  ffeste_end_block_ (block);
}

/* Iterative DO statement.  */

void
ffeste_R819A (ffestw block, ffelab label UNUSED, ffebld var,
	      ffebld start, ffelexToken start_token,
	      ffebld end, ffelexToken end_token,
	      ffebld incr, ffelexToken incr_token)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_begin_iterdo_ (block, NULL, NULL, NULL,
			var,
			start, start_token,
			end, end_token,
			incr, incr_token,
			"Iterative DO loop");
}

/* DO WHILE statement.  */

void
ffeste_R819B (ffestw block, ffelab label UNUSED, ffebld expr)
{
  tree result;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_block_ (block);

  if (expr)
    {
      struct nesting *loop;
      tree mod;

      result = ffecom_make_tempvar ("dowhile", integer_type_node,
				    FFETARGET_charactersizeNONE, -1);
      loop = expand_start_loop (1);

      ffeste_start_stmt_ ();

      ffecom_prepare_expr (expr);

      ffecom_prepare_end ();

      mod = ffecom_modify (void_type_node,
			   result,
			   ffecom_truth_value (ffecom_expr (expr)));
      expand_expr_stmt (mod);

      ffeste_end_stmt_ ();

      ffestw_set_do_hook (block, loop);
      expand_exit_loop_top_cond (0, result);
    }
  else
    ffestw_set_do_hook (block, expand_start_loop (1));

  ffestw_set_do_tvar (block, NULL_TREE);
}

/* END DO statement.

   This is the MIL-STD 1753 END DO. It's syntactic sugar, similar to
   CONTINUE (except that it has to have a label that is the target of
   one or more iterative DO statement), not the Fortran-90 structured
   END DO, which is handled elsewhere, as is the actual mechanism of
   ending an iterative DO statement, even one that ends at a label.  */

void
ffeste_R825 (void)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  emit_nop ();
}

/* CYCLE statement.  */

void
ffeste_R834 (ffestw block)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  expand_continue_loop (ffestw_do_hook (block));
}

/* EXIT statement.  */

void
ffeste_R835 (ffestw block)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  expand_exit_loop (ffestw_do_hook (block));
}

/* GOTO statement.  */

void
ffeste_R836 (ffelab label)
{
  tree glabel;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  glabel = ffecom_lookup_label (label);
  if ((glabel != NULL_TREE)
      && (TREE_CODE (glabel) != ERROR_MARK))
    {
      expand_goto (glabel);
      TREE_USED (glabel) = 1;
    }
}

/* Computed GOTO statement.  */

void
ffeste_R837 (ffelab *labels, int count, ffebld expr)
{
  int i;
  tree texpr;
  tree value;
  tree tlabel;
  int pushok;
  tree duplicate;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (expr);

  ffecom_prepare_end ();

  texpr = ffecom_expr (expr);

  expand_start_case (0, texpr, TREE_TYPE (texpr), "computed GOTO statement");

  for (i = 0; i < count; ++i)
    {
      value = build_int_2 (i + 1, 0);
      tlabel = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);

      pushok = pushcase (value, convert, tlabel, &duplicate);
      assert (pushok == 0);

      tlabel = ffecom_lookup_label (labels[i]);
      if ((tlabel == NULL_TREE)
	  || (TREE_CODE (tlabel) == ERROR_MARK))
	continue;

      expand_goto (tlabel);
      TREE_USED (tlabel) = 1;
    }
  expand_end_case (texpr);

  ffeste_end_stmt_ ();
}

/* ASSIGN statement.  */

void
ffeste_R838 (ffelab label, ffebld target)
{
  tree expr_tree;
  tree label_tree;
  tree target_tree;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

    /* No need to call ffeste_start_stmt_(), as the sorts of expressions
       seen here should never require use of temporaries.  */

  label_tree = ffecom_lookup_label (label);
  if ((label_tree != NULL_TREE)
      && (TREE_CODE (label_tree) != ERROR_MARK))
    {
      label_tree = ffecom_1 (ADDR_EXPR,
			     build_pointer_type (void_type_node),
			     label_tree);
      TREE_CONSTANT (label_tree) = 1;

      target_tree = ffecom_expr_assign_w (target);
      if (TREE_CODE (target_tree) != ERROR_MARK)
      {
        if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (target_tree)))
            < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (label_tree))))
	  error ("ASSIGN to variable that is too small");

        label_tree = convert (TREE_TYPE (target_tree), label_tree);

        expr_tree = ffecom_modify (void_type_node,
				 target_tree,
				 label_tree);
        expand_expr_stmt (expr_tree);
      }
    }
}

/* Assigned GOTO statement.  */

void
ffeste_R839 (ffebld target)
{
  tree t;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  /* No need to call ffeste_start_stmt_(), as the sorts of expressions
     seen here should never require use of temporaries.  */

  t = ffecom_expr_assign (target);

  if (TREE_CODE (t) != ERROR_MARK)
  {
       if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t)))
         < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node))))
       error ("ASSIGNed GOTO target variable is too small");

       expand_computed_goto (convert (TREE_TYPE (null_pointer_node), t));
  }
}

/* Arithmetic IF statement.  */

void
ffeste_R840 (ffebld expr, ffelab neg, ffelab zero, ffelab pos)
{
  tree gneg = ffecom_lookup_label (neg);
  tree gzero = ffecom_lookup_label (zero);
  tree gpos = ffecom_lookup_label (pos);
  tree texpr;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  if ((gneg == NULL_TREE) || (gzero == NULL_TREE) || (gpos == NULL_TREE))
    return;
  if ((TREE_CODE (gneg) == ERROR_MARK)
      || (TREE_CODE (gzero) == ERROR_MARK)
      || (TREE_CODE (gpos) == ERROR_MARK))
    return;

  ffeste_start_stmt_ ();

  ffecom_prepare_expr (expr);

  ffecom_prepare_end ();

  if (neg == zero)
    {
      if (neg == pos)
	expand_goto (gzero);
      else
	{
	  /* IF (expr.LE.0) THEN GOTO neg/zero ELSE GOTO pos.  */
	  texpr = ffecom_expr (expr);
	  texpr = ffecom_2 (LE_EXPR, integer_type_node,
			    texpr,
			    convert (TREE_TYPE (texpr),
				     integer_zero_node));
	  expand_start_cond (ffecom_truth_value (texpr), 0);
	  expand_goto (gzero);
	  expand_start_else ();
	  expand_goto (gpos);
	  expand_end_cond ();
	}
    }
  else if (neg == pos)
    {
      /* IF (expr.NE.0) THEN GOTO neg/pos ELSE GOTO zero.  */
      texpr = ffecom_expr (expr);
      texpr = ffecom_2 (NE_EXPR, integer_type_node,
			texpr,
			convert (TREE_TYPE (texpr),
				 integer_zero_node));
      expand_start_cond (ffecom_truth_value (texpr), 0);
      expand_goto (gneg);
      expand_start_else ();
      expand_goto (gzero);
      expand_end_cond ();
    }
  else if (zero == pos)
    {
      /* IF (expr.GE.0) THEN GOTO zero/pos ELSE GOTO neg.  */
      texpr = ffecom_expr (expr);
      texpr = ffecom_2 (GE_EXPR, integer_type_node,
			texpr,
			convert (TREE_TYPE (texpr),
				 integer_zero_node));
      expand_start_cond (ffecom_truth_value (texpr), 0);
      expand_goto (gzero);
      expand_start_else ();
      expand_goto (gneg);
      expand_end_cond ();
    }
  else
    {
      /* Use a SAVE_EXPR in combo with:
	 IF (expr.LT.0) THEN GOTO neg
	 ELSEIF (expr.GT.0) THEN GOTO pos
	 ELSE GOTO zero.  */
      tree expr_saved = ffecom_save_tree (ffecom_expr (expr));

      texpr = ffecom_2 (LT_EXPR, integer_type_node,
			expr_saved,
			convert (TREE_TYPE (expr_saved),
				 integer_zero_node));
      expand_start_cond (ffecom_truth_value (texpr), 0);
      expand_goto (gneg);
      texpr = ffecom_2 (GT_EXPR, integer_type_node,
			expr_saved,
			convert (TREE_TYPE (expr_saved),
				 integer_zero_node));
      expand_start_elseif (ffecom_truth_value (texpr));
      expand_goto (gpos);
      expand_start_else ();
      expand_goto (gzero);
      expand_end_cond ();
    }

  ffeste_end_stmt_ ();
}

/* CONTINUE statement.  */

void
ffeste_R841 (void)
{
  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  emit_nop ();
}

/* STOP statement.  */

void
ffeste_R842 (ffebld expr)
{
  tree callit;
  ffelexToken msg;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  if ((expr == NULL)
      || (ffeinfo_basictype (ffebld_info (expr))
	  == FFEINFO_basictypeANY))
    {
      msg = ffelex_token_new_character ("",
					ffelex_token_where_line (ffesta_tokens[0]),
					ffelex_token_where_column (ffesta_tokens[0]));
      expr = ffebld_new_conter (ffebld_constant_new_characterdefault
				(msg));
      ffelex_token_kill (msg);
      ffebld_set_info (expr, ffeinfo_new (FFEINFO_basictypeCHARACTER,
					  FFEINFO_kindtypeCHARACTERDEFAULT,
					  0, FFEINFO_kindENTITY,
					  FFEINFO_whereCONSTANT, 0));
    }
  else if (ffeinfo_basictype (ffebld_info (expr))
	   == FFEINFO_basictypeINTEGER)
    {
      char num[50];

      assert (ffebld_op (expr) == FFEBLD_opCONTER);
      assert (ffeinfo_kindtype (ffebld_info (expr))
	      == FFEINFO_kindtypeINTEGERDEFAULT);
      sprintf (num, "%" ffetargetIntegerDefault_f "d",
	       ffebld_constant_integer1 (ffebld_conter (expr)));
      msg = ffelex_token_new_character (num,
					ffelex_token_where_line (ffesta_tokens[0]),
					ffelex_token_where_column (ffesta_tokens[0]));
      expr = ffebld_new_conter (ffebld_constant_new_characterdefault (msg));
      ffelex_token_kill (msg);
      ffebld_set_info (expr, ffeinfo_new (FFEINFO_basictypeCHARACTER,
					  FFEINFO_kindtypeCHARACTERDEFAULT,
					  0, FFEINFO_kindENTITY,
					  FFEINFO_whereCONSTANT, 0));
    }
  else
    {
      assert (ffeinfo_basictype (ffebld_info (expr))
	      == FFEINFO_basictypeCHARACTER);
      assert (ffebld_op (expr) == FFEBLD_opCONTER);
      assert (ffeinfo_kindtype (ffebld_info (expr))
	      == FFEINFO_kindtypeCHARACTERDEFAULT);
    }

  /* No need to call ffeste_start_stmt_(), as the sorts of expressions
     seen here should never require use of temporaries.  */

  callit = ffecom_call_gfrt (FFECOM_gfrtSTOP,
			     ffecom_list_ptr_to_expr (ffebld_new_item (expr, NULL)),
			     NULL_TREE);
  TREE_SIDE_EFFECTS (callit) = 1;

  expand_expr_stmt (callit);
}

/* PAUSE statement.  */

void
ffeste_R843 (ffebld expr)
{
  tree callit;
  ffelexToken msg;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  if ((expr == NULL)
      || (ffeinfo_basictype (ffebld_info (expr))
	  == FFEINFO_basictypeANY))
    {
      msg = ffelex_token_new_character ("",
					ffelex_token_where_line (ffesta_tokens[0]),
					ffelex_token_where_column (ffesta_tokens[0]));
      expr = ffebld_new_conter (ffebld_constant_new_characterdefault (msg));
      ffelex_token_kill (msg);
      ffebld_set_info (expr, ffeinfo_new (FFEINFO_basictypeCHARACTER,
					  FFEINFO_kindtypeCHARACTERDEFAULT,
					  0, FFEINFO_kindENTITY,
					  FFEINFO_whereCONSTANT, 0));
    }
  else if (ffeinfo_basictype (ffebld_info (expr)) == FFEINFO_basictypeINTEGER)
    {
      char num[50];

      assert (ffebld_op (expr) == FFEBLD_opCONTER);
      assert (ffeinfo_kindtype (ffebld_info (expr))
	      == FFEINFO_kindtypeINTEGERDEFAULT);
      sprintf (num, "%" ffetargetIntegerDefault_f "d",
	       ffebld_constant_integer1 (ffebld_conter (expr)));
      msg = ffelex_token_new_character (num, ffelex_token_where_line (ffesta_tokens[0]),
					ffelex_token_where_column (ffesta_tokens[0]));
      expr = ffebld_new_conter (ffebld_constant_new_characterdefault (msg));
      ffelex_token_kill (msg);
      ffebld_set_info (expr, ffeinfo_new (FFEINFO_basictypeCHARACTER,
					  FFEINFO_kindtypeCHARACTERDEFAULT,
					  0, FFEINFO_kindENTITY,
					  FFEINFO_whereCONSTANT, 0));
    }
  else
    {
      assert (ffeinfo_basictype (ffebld_info (expr))
	      == FFEINFO_basictypeCHARACTER);
      assert (ffebld_op (expr) == FFEBLD_opCONTER);
      assert (ffeinfo_kindtype (ffebld_info (expr))
	      == FFEINFO_kindtypeCHARACTERDEFAULT);
    }

  /* No need to call ffeste_start_stmt_(), as the sorts of expressions
     seen here should never require use of temporaries.  */

  callit = ffecom_call_gfrt (FFECOM_gfrtPAUSE,
			     ffecom_list_ptr_to_expr (ffebld_new_item (expr, NULL)),
			     NULL_TREE);
  TREE_SIDE_EFFECTS (callit) = 1;

  expand_expr_stmt (callit);
}

/* OPEN statement.  */

void
ffeste_R904 (ffestpOpenStmt *info)
{
  tree args;
  bool iostat;
  bool errl;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

#define specified(something) (info->open_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_openixIOSTAT);
  errl = specified (FFESTP_openixERR);

#undef specified

  ffeste_start_stmt_ ();

  if (errl)
    {
      ffeste_io_err_
	= ffeste_io_abort_
	= ffecom_lookup_label
	(info->open_spec[FFESTP_openixERR].u.label);
      ffeste_io_abort_is_temp_ = FALSE;
    }
  else
    {
      ffeste_io_err_ = NULL_TREE;

      if ((ffeste_io_abort_is_temp_ = iostat))
	ffeste_io_abort_ = ffecom_temp_label ();
      else
	ffeste_io_abort_ = NULL_TREE;
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = ffecom_expr
	(info->open_spec[FFESTP_openixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("open", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT= or ERR= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  args = ffeste_io_olist_ (errl || iostat,
			   info->open_spec[FFESTP_openixUNIT].u.expr,
			   &info->open_spec[FFESTP_openixFILE],
			   &info->open_spec[FFESTP_openixSTATUS],
			   &info->open_spec[FFESTP_openixACCESS],
			   &info->open_spec[FFESTP_openixFORM],
			   &info->open_spec[FFESTP_openixRECL],
			   &info->open_spec[FFESTP_openixBLANK]);

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
       label, since we're gonna fall through to there anyway. */

  ffeste_io_call_ (ffecom_call_gfrt (FFECOM_gfrtFOPEN, args, NULL_TREE),
		   ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here.  */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      assert (ffeste_io_err_ == NULL_TREE);
    }

  ffeste_end_stmt_ ();
}

/* CLOSE statement.  */

void
ffeste_R907 (ffestpCloseStmt *info)
{
  tree args;
  bool iostat;
  bool errl;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

#define specified(something) (info->close_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_closeixIOSTAT);
  errl = specified (FFESTP_closeixERR);

#undef specified

  ffeste_start_stmt_ ();

  if (errl)
    {
      ffeste_io_err_
	= ffeste_io_abort_
	= ffecom_lookup_label
	(info->close_spec[FFESTP_closeixERR].u.label);
      ffeste_io_abort_is_temp_ = FALSE;
    }
  else
    {
      ffeste_io_err_ = NULL_TREE;

      if ((ffeste_io_abort_is_temp_ = iostat))
	ffeste_io_abort_ = ffecom_temp_label ();
      else
	ffeste_io_abort_ = NULL_TREE;
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = ffecom_expr
	(info->close_spec[FFESTP_closeixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("close", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT= or ERR= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  args = ffeste_io_cllist_ (errl || iostat,
			    info->close_spec[FFESTP_closeixUNIT].u.expr,
			    &info->close_spec[FFESTP_closeixSTATUS]);

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
       label, since we're gonna fall through to there anyway. */

  ffeste_io_call_ (ffecom_call_gfrt (FFECOM_gfrtFCLOS, args, NULL_TREE),
		   ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here. */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      assert (ffeste_io_err_ == NULL_TREE);
    }

  ffeste_end_stmt_ ();
}

/* READ(...) statement -- start.  */

void
ffeste_R909_start (ffestpReadStmt *info, bool only_format UNUSED,
		   ffestvUnit unit, ffestvFormat format, bool rec,
		   bool key UNUSED)
{
  ffecomGfrt start;
  ffecomGfrt end;
  tree cilist;
  bool iostat;
  bool errl;
  bool endl;

  ffeste_check_start_ ();

  ffeste_emit_line_note_ ();

  /* First determine the start, per-item, and end run-time functions to
     call.  The per-item function is picked by choosing an ffeste function
     to call to handle a given item; it knows how to generate a call to the
     appropriate run-time function, and is called an "I/O driver".  */

  switch (format)
    {
    case FFESTV_formatNONE:	/* no FMT= */
      ffeste_io_driver_ = ffeste_io_douio_;
      if (rec)
	start = FFECOM_gfrtSRDUE, end = FFECOM_gfrtERDUE;
      else
	start = FFECOM_gfrtSRSUE, end = FFECOM_gfrtERSUE;
      break;

    case FFESTV_formatLABEL:	/* FMT=10 */
    case FFESTV_formatCHAREXPR:	/* FMT='(I10)' */
    case FFESTV_formatINTEXPR:	/* FMT=I [after ASSIGN 10 TO I] */
      ffeste_io_driver_ = ffeste_io_dofio_;
      if (rec)
	start = FFECOM_gfrtSRDFE, end = FFECOM_gfrtERDFE;
      else if (unit == FFESTV_unitCHAREXPR)
	start = FFECOM_gfrtSRSFI, end = FFECOM_gfrtERSFI;
      else
	start = FFECOM_gfrtSRSFE, end = FFECOM_gfrtERSFE;
      break;

    case FFESTV_formatASTERISK:	/* FMT=* */
      ffeste_io_driver_ = ffeste_io_dolio_;
      if (unit == FFESTV_unitCHAREXPR)
	start = FFECOM_gfrtSRSLI, end = FFECOM_gfrtERSLI;
      else
	start = FFECOM_gfrtSRSLE, end = FFECOM_gfrtERSLE;
      break;

    case FFESTV_formatNAMELIST:	/* FMT=FOO or NML=FOO [NAMELIST
				   /FOO/] */
      ffeste_io_driver_ = NULL;	/* No start or driver function. */
      start = FFECOM_gfrtSRSNE, end = FFECOM_gfrt;
      break;

    default:
      assert ("Weird stuff" == NULL);
      start = FFECOM_gfrt, end = FFECOM_gfrt;
      break;
    }
  ffeste_io_endgfrt_ = end;

#define specified(something) (info->read_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_readixIOSTAT);
  errl = specified (FFESTP_readixERR);
  endl = specified (FFESTP_readixEND);

#undef specified

  ffeste_start_stmt_ ();

  if (errl)
    {
      /* Have ERR= specification.   */

      ffeste_io_err_
	= ffecom_lookup_label (info->read_spec[FFESTP_readixERR].u.label);

      if (endl)
	{
	  /* Have both ERR= and END=.  Need a temp label to handle both.  */
	  ffeste_io_end_
	    = ffecom_lookup_label (info->read_spec[FFESTP_readixEND].u.label);
	  ffeste_io_abort_is_temp_ = TRUE;
	  ffeste_io_abort_ = ffecom_temp_label ();
	}
      else
	{
	  /* Have ERR= but no END=.  */
	  ffeste_io_end_ = NULL_TREE;
	  if ((ffeste_io_abort_is_temp_ = iostat))
	    ffeste_io_abort_ = ffecom_temp_label ();
	  else
	    ffeste_io_abort_ = ffeste_io_err_;
	}
    }
  else
    {
      /* No ERR= specification.  */

      ffeste_io_err_ = NULL_TREE;
      if (endl)
	{
	  /* Have END= but no ERR=.  */
	  ffeste_io_end_
	    = ffecom_lookup_label (info->read_spec[FFESTP_readixEND].u.label);
	  if ((ffeste_io_abort_is_temp_ = iostat))
	    ffeste_io_abort_ = ffecom_temp_label ();
	  else
	    ffeste_io_abort_ = ffeste_io_end_;
	}
      else
	{
	  /* Have no ERR= or END=.  */

	  ffeste_io_end_ = NULL_TREE;
	  if ((ffeste_io_abort_is_temp_ = iostat))
	    ffeste_io_abort_ = ffecom_temp_label ();
	  else
	    ffeste_io_abort_ = NULL_TREE;
	}
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_
	= ffecom_expr (info->read_spec[FFESTP_readixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR= and/or END=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("read", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT=, ERR=, or END= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  if (unit == FFESTV_unitCHAREXPR)
    cilist = ffeste_io_icilist_ (errl || iostat,
				 info->read_spec[FFESTP_readixUNIT].u.expr,
				 endl || iostat, format,
				 &info->read_spec[FFESTP_readixFORMAT]);
  else
    cilist = ffeste_io_cilist_ (errl || iostat, unit,
				info->read_spec[FFESTP_readixUNIT].u.expr,
				5, endl || iostat, format,
				&info->read_spec[FFESTP_readixFORMAT],
				rec,
				info->read_spec[FFESTP_readixREC].u.expr);

  /* If there is no end function, then there are no item functions (i.e.
     it's a NAMELIST), and vice versa by the way.  In this situation, don't
     generate the "if (iostat != 0) goto label;" if the label is temp abort
     label, since we're gonna fall through to there anyway.  */

  ffeste_io_call_ (ffecom_call_gfrt (start, cilist, NULL_TREE),
		   (! ffeste_io_abort_is_temp_) || (end != FFECOM_gfrt));
}

/* READ statement -- I/O item.  */

void
ffeste_R909_item (ffebld expr, ffelexToken expr_token)
{
  ffeste_check_item_ ();

  if (expr == NULL)
    return;

  /* Strip parens off items such as in "READ *,(A)".  This is really a bug
     in the user's code, but I've been told lots of code does this.  */
  while (ffebld_op (expr) == FFEBLD_opPAREN)
    expr = ffebld_left (expr);

  if (ffebld_op (expr) == FFEBLD_opANY)
    return;

  if (ffebld_op (expr) == FFEBLD_opIMPDO)
    ffeste_io_impdo_ (expr, expr_token);
  else
    {
      ffeste_start_stmt_ ();

      ffecom_prepare_arg_ptr_to_expr (expr);

      ffecom_prepare_end ();

      ffeste_io_call_ ((*ffeste_io_driver_) (expr), TRUE);

      ffeste_end_stmt_ ();
    }
}

/* READ statement -- end.  */

void
ffeste_R909_finish (void)
{
  ffeste_check_finish_ ();

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
     label, since we're gonna fall through to there anyway. */

  if (ffeste_io_endgfrt_ != FFECOM_gfrt)
    ffeste_io_call_ (ffecom_call_gfrt (ffeste_io_endgfrt_, NULL_TREE,
				       NULL_TREE),
		     ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here and have it fan out
     to the END= or ERR= label as appropriate. */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      /* "if (iostat<0) goto end_label;".  */

      if ((ffeste_io_end_ != NULL_TREE)
	  && (TREE_CODE (ffeste_io_end_) != ERROR_MARK))
	{
	  expand_start_cond (ffecom_truth_value
			     (ffecom_2 (LT_EXPR, integer_type_node,
					ffeste_io_iostat_,
					ffecom_integer_zero_node)),
			     0);
	  expand_goto (ffeste_io_end_);
	  expand_end_cond ();
	}

      /* "if (iostat>0) goto err_label;".  */

      if ((ffeste_io_err_ != NULL_TREE)
	  && (TREE_CODE (ffeste_io_err_) != ERROR_MARK))
	{
	  expand_start_cond (ffecom_truth_value
			     (ffecom_2 (GT_EXPR, integer_type_node,
					ffeste_io_iostat_,
					ffecom_integer_zero_node)),
			     0);
	  expand_goto (ffeste_io_err_);
	  expand_end_cond ();
	}
    }

  ffeste_end_stmt_ ();
}

/* WRITE statement -- start.  */

void
ffeste_R910_start (ffestpWriteStmt *info, ffestvUnit unit,
		   ffestvFormat format, bool rec)
{
  ffecomGfrt start;
  ffecomGfrt end;
  tree cilist;
  bool iostat;
  bool errl;

  ffeste_check_start_ ();

  ffeste_emit_line_note_ ();

  /* First determine the start, per-item, and end run-time functions to
     call.  The per-item function is picked by choosing an ffeste function
     to call to handle a given item; it knows how to generate a call to the
     appropriate run-time function, and is called an "I/O driver".  */

  switch (format)
    {
    case FFESTV_formatNONE:	/* no FMT= */
      ffeste_io_driver_ = ffeste_io_douio_;
      if (rec)
	start = FFECOM_gfrtSWDUE, end = FFECOM_gfrtEWDUE;
      else
	start = FFECOM_gfrtSWSUE, end = FFECOM_gfrtEWSUE;
      break;

    case FFESTV_formatLABEL:	/* FMT=10 */
    case FFESTV_formatCHAREXPR:	/* FMT='(I10)' */
    case FFESTV_formatINTEXPR:	/* FMT=I [after ASSIGN 10 TO I] */
      ffeste_io_driver_ = ffeste_io_dofio_;
      if (rec)
	start = FFECOM_gfrtSWDFE, end = FFECOM_gfrtEWDFE;
      else if (unit == FFESTV_unitCHAREXPR)
	start = FFECOM_gfrtSWSFI, end = FFECOM_gfrtEWSFI;
      else
	start = FFECOM_gfrtSWSFE, end = FFECOM_gfrtEWSFE;
      break;

    case FFESTV_formatASTERISK:	/* FMT=* */
      ffeste_io_driver_ = ffeste_io_dolio_;
      if (unit == FFESTV_unitCHAREXPR)
	start = FFECOM_gfrtSWSLI, end = FFECOM_gfrtEWSLI;
      else
	start = FFECOM_gfrtSWSLE, end = FFECOM_gfrtEWSLE;
      break;

    case FFESTV_formatNAMELIST:	/* FMT=FOO or NML=FOO [NAMELIST
				   /FOO/] */
      ffeste_io_driver_ = NULL;	/* No start or driver function. */
      start = FFECOM_gfrtSWSNE, end = FFECOM_gfrt;
      break;

    default:
      assert ("Weird stuff" == NULL);
      start = FFECOM_gfrt, end = FFECOM_gfrt;
      break;
    }
  ffeste_io_endgfrt_ = end;

#define specified(something) (info->write_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_writeixIOSTAT);
  errl = specified (FFESTP_writeixERR);

#undef specified

  ffeste_start_stmt_ ();

  ffeste_io_end_ = NULL_TREE;

  if (errl)
    {
      /* Have ERR= specification.   */

      ffeste_io_err_
	= ffeste_io_abort_
	= ffecom_lookup_label
	(info->write_spec[FFESTP_writeixERR].u.label);
      ffeste_io_abort_is_temp_ = FALSE;
    }
  else
    {
      /* No ERR= specification.  */

      ffeste_io_err_ = NULL_TREE;

      if ((ffeste_io_abort_is_temp_ = iostat))
	ffeste_io_abort_ = ffecom_temp_label ();
      else
	ffeste_io_abort_ = NULL_TREE;
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = ffecom_expr
	(info->write_spec[FFESTP_writeixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("write", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT= or ERR= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  if (unit == FFESTV_unitCHAREXPR)
    cilist = ffeste_io_icilist_ (errl || iostat,
				 info->write_spec[FFESTP_writeixUNIT].u.expr,
				 FALSE, format,
				 &info->write_spec[FFESTP_writeixFORMAT]);
  else
    cilist = ffeste_io_cilist_ (errl || iostat, unit,
				info->write_spec[FFESTP_writeixUNIT].u.expr,
				6, FALSE, format,
				&info->write_spec[FFESTP_writeixFORMAT],
				rec,
				info->write_spec[FFESTP_writeixREC].u.expr);

  /* If there is no end function, then there are no item functions (i.e.
     it's a NAMELIST), and vice versa by the way.  In this situation, don't
     generate the "if (iostat != 0) goto label;" if the label is temp abort
     label, since we're gonna fall through to there anyway.  */

  ffeste_io_call_ (ffecom_call_gfrt (start, cilist, NULL_TREE),
		   (! ffeste_io_abort_is_temp_) || (end != FFECOM_gfrt));
}

/* WRITE statement -- I/O item.  */

void
ffeste_R910_item (ffebld expr, ffelexToken expr_token)
{
  ffeste_check_item_ ();

  if (expr == NULL)
    return;

  if (ffebld_op (expr) == FFEBLD_opANY)
    return;

  if (ffebld_op (expr) == FFEBLD_opIMPDO)
    ffeste_io_impdo_ (expr, expr_token);
  else
    {
      ffeste_start_stmt_ ();

      ffecom_prepare_arg_ptr_to_expr (expr);

      ffecom_prepare_end ();

      ffeste_io_call_ ((*ffeste_io_driver_) (expr), TRUE);

      ffeste_end_stmt_ ();
    }
}

/* WRITE statement -- end.  */

void
ffeste_R910_finish (void)
{
  ffeste_check_finish_ ();

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
     label, since we're gonna fall through to there anyway. */

  if (ffeste_io_endgfrt_ != FFECOM_gfrt)
    ffeste_io_call_ (ffecom_call_gfrt (ffeste_io_endgfrt_, NULL_TREE,
				       NULL_TREE),
		     ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here. */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      assert (ffeste_io_err_ == NULL_TREE);
    }

  ffeste_end_stmt_ ();
}

/* PRINT statement -- start.  */

void
ffeste_R911_start (ffestpPrintStmt *info, ffestvFormat format)
{
  ffecomGfrt start;
  ffecomGfrt end;
  tree cilist;

  ffeste_check_start_ ();

  ffeste_emit_line_note_ ();

  /* First determine the start, per-item, and end run-time functions to
     call.  The per-item function is picked by choosing an ffeste function
     to call to handle a given item; it knows how to generate a call to the
     appropriate run-time function, and is called an "I/O driver".  */

  switch (format)
    {
    case FFESTV_formatLABEL:	/* FMT=10 */
    case FFESTV_formatCHAREXPR:	/* FMT='(I10)' */
    case FFESTV_formatINTEXPR:	/* FMT=I [after ASSIGN 10 TO I] */
      ffeste_io_driver_ = ffeste_io_dofio_;
      start = FFECOM_gfrtSWSFE, end = FFECOM_gfrtEWSFE;
      break;

    case FFESTV_formatASTERISK:	/* FMT=* */
      ffeste_io_driver_ = ffeste_io_dolio_;
      start = FFECOM_gfrtSWSLE, end = FFECOM_gfrtEWSLE;
      break;

    case FFESTV_formatNAMELIST:	/* FMT=FOO or NML=FOO [NAMELIST
				   /FOO/] */
      ffeste_io_driver_ = NULL;	/* No start or driver function. */
      start = FFECOM_gfrtSWSNE, end = FFECOM_gfrt;
      break;

    default:
      assert ("Weird stuff" == NULL);
      start = FFECOM_gfrt, end = FFECOM_gfrt;
      break;
    }
  ffeste_io_endgfrt_ = end;

  ffeste_start_stmt_ ();

  ffeste_io_end_ = NULL_TREE;
  ffeste_io_err_ = NULL_TREE;
  ffeste_io_abort_ = NULL_TREE;
  ffeste_io_abort_is_temp_ = FALSE;
  ffeste_io_iostat_is_temp_ = FALSE;
  ffeste_io_iostat_ = NULL_TREE;

  /* Now prescan, then convert, all the arguments.  */

  cilist = ffeste_io_cilist_ (FALSE, FFESTV_unitNONE, NULL, 6, FALSE, format,
			      &info->print_spec[FFESTP_printixFORMAT],
			      FALSE, NULL);

  /* If there is no end function, then there are no item functions (i.e.
     it's a NAMELIST), and vice versa by the way.  In this situation, don't
     generate the "if (iostat != 0) goto label;" if the label is temp abort
     label, since we're gonna fall through to there anyway.  */

  ffeste_io_call_ (ffecom_call_gfrt (start, cilist, NULL_TREE),
		   (! ffeste_io_abort_is_temp_) || (end != FFECOM_gfrt));
}

/* PRINT statement -- I/O item.  */

void
ffeste_R911_item (ffebld expr, ffelexToken expr_token)
{
  ffeste_check_item_ ();

  if (expr == NULL)
    return;

  if (ffebld_op (expr) == FFEBLD_opANY)
    return;

  if (ffebld_op (expr) == FFEBLD_opIMPDO)
    ffeste_io_impdo_ (expr, expr_token);
  else
    {
      ffeste_start_stmt_ ();

      ffecom_prepare_arg_ptr_to_expr (expr);

      ffecom_prepare_end ();

      ffeste_io_call_ ((*ffeste_io_driver_) (expr), TRUE);

      ffeste_end_stmt_ ();
    }
}

/* PRINT statement -- end.  */

void
ffeste_R911_finish (void)
{
  ffeste_check_finish_ ();

  if (ffeste_io_endgfrt_ != FFECOM_gfrt)
    ffeste_io_call_ (ffecom_call_gfrt (ffeste_io_endgfrt_, NULL_TREE,
				       NULL_TREE),
		     FALSE);

  ffeste_end_stmt_ ();
}

/* BACKSPACE statement.  */

void
ffeste_R919 (ffestpBeruStmt *info)
{
  ffeste_check_simple_ ();

  ffeste_subr_beru_ (info, FFECOM_gfrtFBACK);
}

/* ENDFILE statement.  */

void
ffeste_R920 (ffestpBeruStmt *info)
{
  ffeste_check_simple_ ();

  ffeste_subr_beru_ (info, FFECOM_gfrtFEND);
}

/* REWIND statement.  */

void
ffeste_R921 (ffestpBeruStmt *info)
{
  ffeste_check_simple_ ();

  ffeste_subr_beru_ (info, FFECOM_gfrtFREW);
}

/* INQUIRE statement (non-IOLENGTH version).  */

void
ffeste_R923A (ffestpInquireStmt *info, bool by_file UNUSED)
{
  tree args;
  bool iostat;
  bool errl;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

#define specified(something) (info->inquire_spec[something].kw_or_val_present)

  iostat = specified (FFESTP_inquireixIOSTAT);
  errl = specified (FFESTP_inquireixERR);

#undef specified

  ffeste_start_stmt_ ();

  if (errl)
    {
      ffeste_io_err_
	= ffeste_io_abort_
	= ffecom_lookup_label
	(info->inquire_spec[FFESTP_inquireixERR].u.label);
      ffeste_io_abort_is_temp_ = FALSE;
    }
  else
    {
      ffeste_io_err_ = NULL_TREE;

      if ((ffeste_io_abort_is_temp_ = iostat))
	ffeste_io_abort_ = ffecom_temp_label ();
      else
	ffeste_io_abort_ = NULL_TREE;
    }

  if (iostat)
    {
      /* Have IOSTAT= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = ffecom_expr
	(info->inquire_spec[FFESTP_inquireixIOSTAT].u.expr);
    }
  else if (ffeste_io_abort_ != NULL_TREE)
    {
      /* Have no IOSTAT= but have ERR=.  */

      ffeste_io_iostat_is_temp_ = TRUE;
      ffeste_io_iostat_
	= ffecom_make_tempvar ("inquire", ffecom_integer_type_node,
			       FFETARGET_charactersizeNONE, -1);
    }
  else
    {
      /* No IOSTAT= or ERR= specification.  */

      ffeste_io_iostat_is_temp_ = FALSE;
      ffeste_io_iostat_ = NULL_TREE;
    }

  /* Now prescan, then convert, all the arguments.  */

  args
    = ffeste_io_inlist_ (errl || iostat,
			 &info->inquire_spec[FFESTP_inquireixUNIT],
			 &info->inquire_spec[FFESTP_inquireixFILE],
			 &info->inquire_spec[FFESTP_inquireixEXIST],
			 &info->inquire_spec[FFESTP_inquireixOPENED],
			 &info->inquire_spec[FFESTP_inquireixNUMBER],
			 &info->inquire_spec[FFESTP_inquireixNAMED],
			 &info->inquire_spec[FFESTP_inquireixNAME],
			 &info->inquire_spec[FFESTP_inquireixACCESS],
			 &info->inquire_spec[FFESTP_inquireixSEQUENTIAL],
			 &info->inquire_spec[FFESTP_inquireixDIRECT],
			 &info->inquire_spec[FFESTP_inquireixFORM],
			 &info->inquire_spec[FFESTP_inquireixFORMATTED],
			 &info->inquire_spec[FFESTP_inquireixUNFORMATTED],
			 &info->inquire_spec[FFESTP_inquireixRECL],
			 &info->inquire_spec[FFESTP_inquireixNEXTREC],
			 &info->inquire_spec[FFESTP_inquireixBLANK]);

  /* Don't generate "if (iostat != 0) goto label;" if label is temp abort
     label, since we're gonna fall through to there anyway. */

  ffeste_io_call_ (ffecom_call_gfrt (FFECOM_gfrtFINQU, args, NULL_TREE),
		   ! ffeste_io_abort_is_temp_);

  /* If we've got a temp label, generate its code here.  */

  if (ffeste_io_abort_is_temp_)
    {
      DECL_INITIAL (ffeste_io_abort_) = error_mark_node;
      emit_nop ();
      expand_label (ffeste_io_abort_);

      assert (ffeste_io_err_ == NULL_TREE);
    }

  ffeste_end_stmt_ ();
}

/* INQUIRE(IOLENGTH=expr) statement -- start.  */

void
ffeste_R923B_start (ffestpInquireStmt *info UNUSED)
{
  ffeste_check_start_ ();

  assert ("INQUIRE(IOLENGTH=<var>) not implemented yet! ~~~" == NULL);

  ffeste_emit_line_note_ ();
}

/* INQUIRE(IOLENGTH=expr) statement -- I/O item.  */

void
ffeste_R923B_item (ffebld expr UNUSED)
{
  ffeste_check_item_ ();
}

/* INQUIRE(IOLENGTH=expr) statement -- end.  */

void
ffeste_R923B_finish (void)
{
  ffeste_check_finish_ ();
}

/* ffeste_R1001 -- FORMAT statement

   ffeste_R1001(format_list);  */

void
ffeste_R1001 (ffests s)
{
  tree t;
  tree ttype;
  tree maxindex;
  tree var;

  ffeste_check_simple_ ();

  assert (ffeste_label_formatdef_ != NULL);

  ffeste_emit_line_note_ ();

  t = build_string (ffests_length (s), ffests_text (s));

  TREE_TYPE (t)
    = build_type_variant (build_array_type
			  (char_type_node,
			   build_range_type (integer_type_node,
					     integer_one_node,
					     build_int_2 (ffests_length (s),
							  0))),
			  1, 0);
  TREE_CONSTANT (t) = 1;
  TREE_STATIC (t) = 1;

  var = ffecom_lookup_label (ffeste_label_formatdef_);
  if ((var != NULL_TREE)
      && (TREE_CODE (var) == VAR_DECL))
    {
      DECL_INITIAL (var) = t;
      maxindex = build_int_2 (ffests_length (s) - 1, 0);
      ttype = TREE_TYPE (var);
      TYPE_DOMAIN (ttype) = build_range_type (integer_type_node,
					      integer_zero_node,
					      maxindex);
      if (!TREE_TYPE (maxindex))
	TREE_TYPE (maxindex) = TYPE_DOMAIN (ttype);
      layout_type (ttype);
      rest_of_decl_compilation (var, NULL, 1, 0);
      expand_decl (var);
      expand_decl_init (var);
    }

  ffeste_label_formatdef_ = NULL;
}

/* END PROGRAM.  */

void
ffeste_R1103 (void)
{
}

/* END BLOCK DATA.  */

void
ffeste_R1112 (void)
{
}

/* CALL statement.  */

void
ffeste_R1212 (ffebld expr)
{
  ffebld args;
  ffebld arg;
  ffebld labels = NULL;	/* First in list of LABTERs. */
  ffebld prevlabels = NULL;
  ffebld prevargs = NULL;

  ffeste_check_simple_ ();

  args = ffebld_right (expr);

  ffeste_emit_line_note_ ();

  /* Here we split the list at ffebld_right(expr) into two lists: one at
     ffebld_right(expr) consisting of all items that are not LABTERs, the
     other at labels consisting of all items that are LABTERs.  Then, if
     the latter list is NULL, we have an ordinary call, else we have a call
     with alternate returns. */

  for (args = ffebld_right (expr); args != NULL; args = ffebld_trail (args))
    {
      if (((arg = ffebld_head (args)) == NULL)
	  || (ffebld_op (arg) != FFEBLD_opLABTER))
	{
	  if (prevargs == NULL)
	    {
	      prevargs = args;
	      ffebld_set_right (expr, args);
	    }
	  else
	    {
	      ffebld_set_trail (prevargs, args);
	      prevargs = args;
	    }
	}
      else
	{
	  if (prevlabels == NULL)
	    {
	      prevlabels = labels = args;
	    }
	  else
	    {
	      ffebld_set_trail (prevlabels, args);
	      prevlabels = args;
	    }
	}
    }
  if (prevlabels == NULL)
    labels = NULL;
  else
    ffebld_set_trail (prevlabels, NULL);
  if (prevargs == NULL)
    ffebld_set_right (expr, NULL);
  else
    ffebld_set_trail (prevargs, NULL);

  ffeste_start_stmt_ ();

  /* No temporaries are actually needed at this level, but we go
     through the motions anyway, just to be sure in case they do
     get made.  Temporaries needed for arguments should be in the
     scopes of inner blocks, and if clean-up actions are supported,
     such as CALL-ing an intrinsic that writes to an argument of one
     type when a variable of a different type is provided (requiring
     assignment to the variable from a temporary after the library
     routine returns), the clean-up must be done by the expression
     evaluator, generally, to handle alternate returns (which we hope
     won't ever be supported by intrinsics, but might be a similar
     issue, such as CALL-ing an F90-style subroutine with an INTERFACE
     block).  That implies the expression evaluator will have to
     recognize the need for its own temporary anyway, meaning it'll
     construct a block within the one constructed here.  */

  ffecom_prepare_expr (expr);

  ffecom_prepare_end ();

  if (labels == NULL)
    expand_expr_stmt (ffecom_expr (expr));
  else
    {
      tree texpr;
      tree value;
      tree tlabel;
      int caseno;
      int pushok;
      tree duplicate;
      ffebld label;

      texpr = ffecom_expr (expr);
      expand_start_case (0, texpr, TREE_TYPE (texpr), "CALL statement");

      for (caseno = 1, label = labels;
	   label != NULL;
	   ++caseno, label = ffebld_trail (label))
	{
	  value = build_int_2 (caseno, 0);
	  tlabel = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);

	  pushok = pushcase (value, convert, tlabel, &duplicate);
	  assert (pushok == 0);

	  tlabel
	    = ffecom_lookup_label (ffebld_labter (ffebld_head (label)));
	  if ((tlabel == NULL_TREE)
	      || (TREE_CODE (tlabel) == ERROR_MARK))
	    continue;
	  TREE_USED (tlabel) = 1;
	  expand_goto (tlabel);
	}

      expand_end_case (texpr);
    }

  ffeste_end_stmt_ ();
}

/* END FUNCTION.  */

void
ffeste_R1221 (void)
{
}

/* END SUBROUTINE.  */

void
ffeste_R1225 (void)
{
}

/* ENTRY statement.  */

void
ffeste_R1226 (ffesymbol entry)
{
  tree label;

  ffeste_check_simple_ ();

  label = ffesymbol_hook (entry).length_tree;

  ffeste_emit_line_note_ ();

  if (label == error_mark_node)
    return;

  DECL_INITIAL (label) = error_mark_node;
  emit_nop ();
  expand_label (label);
}

/* RETURN statement.  */

void
ffeste_R1227 (ffestw block UNUSED, ffebld expr)
{
  tree rtn;

  ffeste_check_simple_ ();

  ffeste_emit_line_note_ ();

  ffeste_start_stmt_ ();

  ffecom_prepare_return_expr (expr);

  ffecom_prepare_end ();

  rtn = ffecom_return_expr (expr);

  if ((rtn == NULL_TREE)
      || (rtn == error_mark_node))
    expand_null_return ();
  else
    {
      tree result = DECL_RESULT (current_function_decl);

      if ((result != error_mark_node)
	  && (TREE_TYPE (result) != error_mark_node))
	expand_return (ffecom_modify (NULL_TREE,
				      result,
				      convert (TREE_TYPE (result),
					       rtn)));
      else
	expand_null_return ();
    }

  ffeste_end_stmt_ ();
}

/* REWRITE statement -- start.  */

/* TYPE statement -- start.  */

void
ffeste_V020_start (ffestpTypeStmt *info UNUSED,
		   ffestvFormat format UNUSED)
{
  ffeste_check_start_ ();
}

/* TYPE statement -- I/O item.  */

void
ffeste_V020_item (ffebld expr UNUSED)
{
  ffeste_check_item_ ();
}

/* TYPE statement -- end.  */

void
ffeste_V020_finish (void)
{
  ffeste_check_finish_ ();
}

/* DELETE statement.  */


#ifdef ENABLE_CHECKING
void
ffeste_terminate_2 (void)
{
  assert (! ffeste_top_block_);
}
#endif

#include "gt-f-ste.h"
OpenPOWER on IntegriCloud