pa.md (integer_indexed_store splitters): Use mem_shadd_operand.
[gcc.git] / gcc / ada / gnat1drv.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T 1 D R V --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
25
26 with Atree; use Atree;
27 with Back_End; use Back_End;
28 with Checks;
29 with Comperr;
30 with Csets; use Csets;
31 with Debug; use Debug;
32 with Elists;
33 with Errout; use Errout;
34 with Exp_CG;
35 with Fmap;
36 with Fname; use Fname;
37 with Fname.UF; use Fname.UF;
38 with Frontend;
39 with Ghost;
40 with Gnatvsn; use Gnatvsn;
41 with Inline;
42 with Lib; use Lib;
43 with Lib.Writ; use Lib.Writ;
44 with Lib.Xref;
45 with Namet; use Namet;
46 with Nlists;
47 with Opt; use Opt;
48 with Osint; use Osint;
49 with Output; use Output;
50 with Par_SCO;
51 with Prepcomp;
52 with Repinfo; use Repinfo;
53 with Restrict;
54 with Rident; use Rident;
55 with Rtsfind;
56 with SCOs;
57 with Sem;
58 with Sem_Ch8;
59 with Sem_Ch12;
60 with Sem_Ch13;
61 with Sem_Elim;
62 with Sem_Eval;
63 with Sem_Type;
64 with Set_Targ;
65 with Sinfo; use Sinfo;
66 with Sinput.L; use Sinput.L;
67 with Snames;
68 with Sprint; use Sprint;
69 with Stringt;
70 with Stylesw; use Stylesw;
71 with Targparm; use Targparm;
72 with Tbuild;
73 with Tree_Gen;
74 with Treepr; use Treepr;
75 with Ttypes;
76 with Types; use Types;
77 with Uintp; use Uintp;
78 with Uname; use Uname;
79 with Urealp;
80 with Usage;
81 with Validsw; use Validsw;
82
83 with System.Assertions;
84 with System.OS_Lib;
85
86 --------------
87 -- Gnat1drv --
88 --------------
89
90 procedure Gnat1drv is
91 Main_Unit_Node : Node_Id;
92 -- Compilation unit node for main unit
93
94 Main_Kind : Node_Kind;
95 -- Kind of main compilation unit node
96
97 Back_End_Mode : Back_End.Back_End_Mode_Type;
98 -- Record back end mode
99
100 procedure Adjust_Global_Switches;
101 -- There are various interactions between front end switch settings,
102 -- including debug switch settings and target dependent parameters.
103 -- This procedure takes care of properly handling these interactions.
104 -- We do it after scanning out all the switches, so that we are not
105 -- depending on the order in which switches appear.
106
107 procedure Check_Bad_Body;
108 -- Called to check if the unit we are compiling has a bad body
109
110 procedure Check_Rep_Info;
111 -- Called when we are not generating code, to check if -gnatR was requested
112 -- and if so, explain that we will not be honoring the request.
113
114 procedure Post_Compilation_Validation_Checks;
115 -- This procedure performs various validation checks that have to be left
116 -- to the end of the compilation process, after generating code but before
117 -- issuing error messages. In particular, these checks generally require
118 -- the information provided by the back end in back annotation of declared
119 -- entities (e.g. actual size and alignment values chosen by the back end).
120
121 ----------------------------
122 -- Adjust_Global_Switches --
123 ----------------------------
124
125 procedure Adjust_Global_Switches is
126 begin
127 -- -gnatd.M enables Relaxed_RM_Semantics
128
129 if Debug_Flag_Dot_MM then
130 Relaxed_RM_Semantics := True;
131 end if;
132
133 -- -gnatd.1 enables unnesting of subprograms
134
135 if Debug_Flag_Dot_1 then
136 Unnest_Subprogram_Mode := True;
137 end if;
138
139 -- -gnatd.V or -gnatd.u enables special C expansion mode
140
141 if Debug_Flag_Dot_VV or Debug_Flag_Dot_U then
142 Modify_Tree_For_C := True;
143 end if;
144
145 -- Other flags set if we are generating C code
146
147 if Debug_Flag_Dot_VV then
148 Generate_C_Code := True;
149 Unnest_Subprogram_Mode := True;
150 end if;
151
152 -- -gnatd.E sets Error_To_Warning mode, causing selected error messages
153 -- to be treated as warnings instead of errors.
154
155 if Debug_Flag_Dot_EE then
156 Error_To_Warning := True;
157 end if;
158
159 -- Disable CodePeer_Mode in Check_Syntax, since we need front-end
160 -- expansion.
161
162 if Operating_Mode = Check_Syntax then
163 CodePeer_Mode := False;
164 end if;
165
166 -- Set ASIS mode if -gnatt and -gnatc are set
167
168 if Operating_Mode = Check_Semantics and then Tree_Output then
169 ASIS_Mode := True;
170
171 -- Turn off inlining in ASIS mode, since ASIS cannot handle the extra
172 -- information in the trees caused by inlining being active.
173
174 -- More specifically, the tree seems to be malformed from the ASIS
175 -- point of view if -gnatc and -gnatn appear together???
176
177 Inline_Active := False;
178
179 -- Turn off SCIL generation and CodePeer mode in semantics mode,
180 -- since SCIL requires front-end expansion.
181
182 Generate_SCIL := False;
183 CodePeer_Mode := False;
184 end if;
185
186 -- SCIL mode needs to disable front-end inlining since the generated
187 -- trees (in particular order and consistency between specs compiled
188 -- as part of a main unit or as part of a with-clause) are causing
189 -- troubles.
190
191 if Generate_SCIL then
192 Front_End_Inlining := False;
193 end if;
194
195 -- Tune settings for optimal SCIL generation in CodePeer mode
196
197 if CodePeer_Mode then
198
199 -- Turn off gnatprove mode (which can be set via e.g. -gnatd.F), not
200 -- compatible with CodePeer mode.
201
202 GNATprove_Mode := False;
203 Debug_Flag_Dot_FF := False;
204
205 -- Turn off inlining, confuses CodePeer output and gains nothing
206
207 Front_End_Inlining := False;
208 Inline_Active := False;
209
210 -- Disable front-end optimizations, to keep the tree as close to the
211 -- source code as possible, and also to avoid inconsistencies between
212 -- trees when using different optimization switches.
213
214 Optimization_Level := 0;
215
216 -- Enable some restrictions systematically to simplify the generated
217 -- code (and ease analysis). Note that restriction checks are also
218 -- disabled in CodePeer mode, see Restrict.Check_Restriction, and
219 -- user specified Restrictions pragmas are ignored, see
220 -- Sem_Prag.Process_Restrictions_Or_Restriction_Warnings.
221
222 Restrict.Restrictions.Set (No_Initialize_Scalars) := True;
223 Restrict.Restrictions.Set (No_Task_Hierarchy) := True;
224 Restrict.Restrictions.Set (No_Abort_Statements) := True;
225 Restrict.Restrictions.Set (Max_Asynchronous_Select_Nesting) := True;
226 Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0;
227
228 -- Suppress division by zero and access checks since they are handled
229 -- implicitly by CodePeer.
230
231 -- Turn off dynamic elaboration checks: generates inconsistencies in
232 -- trees between specs compiled as part of a main unit or as part of
233 -- a with-clause.
234
235 -- Turn off alignment checks: these cannot be proved statically by
236 -- CodePeer and generate false positives.
237
238 -- Enable all other language checks
239
240 Suppress_Options.Suppress :=
241 (Access_Check => True,
242 Alignment_Check => True,
243 Division_Check => True,
244 Elaboration_Check => True,
245 others => False);
246
247 Dynamic_Elaboration_Checks := False;
248
249 -- Set STRICT mode for overflow checks if not set explicitly. This
250 -- prevents suppressing of overflow checks by default, in code down
251 -- below.
252
253 if Suppress_Options.Overflow_Mode_General = Not_Set then
254 Suppress_Options.Overflow_Mode_General := Strict;
255 Suppress_Options.Overflow_Mode_Assertions := Strict;
256 end if;
257
258 -- CodePeer handles division and overflow checks directly, based on
259 -- the marks set by the frontend, hence no special expansion should
260 -- be performed in the frontend for division and overflow checks.
261
262 Backend_Divide_Checks_On_Target := True;
263 Backend_Overflow_Checks_On_Target := True;
264
265 -- Kill debug of generated code, since it messes up sloc values
266
267 Debug_Generated_Code := False;
268
269 -- Turn cross-referencing on in case it was disabled (e.g. by -gnatD)
270 -- Do we really need to spend time generating xref in CodePeer
271 -- mode??? Consider setting Xref_Active to False.
272
273 Xref_Active := True;
274
275 -- Polling mode forced off, since it generates confusing junk
276
277 Polling_Required := False;
278
279 -- Set operating mode to Generate_Code to benefit from full front-end
280 -- expansion (e.g. generics).
281
282 Operating_Mode := Generate_Code;
283
284 -- We need SCIL generation of course
285
286 Generate_SCIL := True;
287
288 -- Enable assertions, since they give CodePeer valuable extra info
289
290 Assertions_Enabled := True;
291
292 -- Disable all simple value propagation. This is an optimization
293 -- which is valuable for code optimization, and also for generation
294 -- of compiler warnings, but these are being turned off by default,
295 -- and CodePeer generates better messages (referencing original
296 -- variables) this way.
297
298 Debug_Flag_MM := True;
299
300 -- Set normal RM validity checking, and checking of IN OUT parameters
301 -- (this might give CodePeer more useful checks to analyze, to be
302 -- confirmed???). All other validity checking is turned off, since
303 -- this can generate very complex trees that only confuse CodePeer
304 -- and do not bring enough useful info.
305
306 Reset_Validity_Check_Options;
307 Validity_Check_Default := True;
308 Validity_Check_In_Out_Params := True;
309 Validity_Check_In_Params := True;
310
311 -- Turn off style check options and ignore any style check pragmas
312 -- since we are not interested in any front-end warnings when we are
313 -- getting CodePeer output.
314
315 Reset_Style_Check_Options;
316 Ignore_Style_Checks_Pragmas := True;
317
318 -- Always perform semantics and generate ali files in CodePeer mode,
319 -- so that a gnatmake -c -k will proceed further when possible.
320
321 Force_ALI_Tree_File := True;
322 Try_Semantics := True;
323
324 -- Make the Ada front-end more liberal so that the compiler will
325 -- allow illegal code that is allowed by other compilers. CodePeer
326 -- is in the business of finding problems, not enforcing rules.
327 -- This is useful when using CodePeer mode with other compilers.
328
329 Relaxed_RM_Semantics := True;
330 end if;
331
332 -- Enable some individual switches that are implied by relaxed RM
333 -- semantics mode.
334
335 if Relaxed_RM_Semantics then
336 Opt.Allow_Integer_Address := True;
337 Overriding_Renamings := True;
338 Treat_Categorization_Errors_As_Warnings := True;
339 end if;
340
341 -- Enable GNATprove_Mode when using -gnatd.F switch
342
343 if Debug_Flag_Dot_FF then
344 GNATprove_Mode := True;
345 end if;
346
347 -- GNATprove_Mode is also activated by default in the gnat2why
348 -- executable.
349
350 if GNATprove_Mode then
351
352 -- Turn off inlining, which would confuse formal verification output
353 -- and gain nothing.
354
355 Front_End_Inlining := False;
356 Inline_Active := False;
357
358 -- Issue warnings for failure to inline subprograms, as otherwise
359 -- expected in GNATprove mode for the local subprograms without
360 -- contracts.
361
362 Ineffective_Inline_Warnings := True;
363
364 -- Disable front-end optimizations, to keep the tree as close to the
365 -- source code as possible, and also to avoid inconsistencies between
366 -- trees when using different optimization switches.
367
368 Optimization_Level := 0;
369
370 -- Enable some restrictions systematically to simplify the generated
371 -- code (and ease analysis). Note that restriction checks are also
372 -- disabled in SPARK mode, see Restrict.Check_Restriction, and user
373 -- specified Restrictions pragmas are ignored, see
374 -- Sem_Prag.Process_Restrictions_Or_Restriction_Warnings.
375
376 Restrict.Restrictions.Set (No_Initialize_Scalars) := True;
377
378 -- Note: at this point we used to suppress various checks, but that
379 -- is not what we want. We need the semantic processing for these
380 -- checks (which will set flags like Do_Overflow_Check, showing the
381 -- points at which potential checks are required semantically). We
382 -- don't want the expansion associated with these checks, but that
383 -- happens anyway because this expansion is simply not done in the
384 -- SPARK version of the expander.
385
386 -- On the contrary, we need to enable explicitly all language checks,
387 -- as they may have been suppressed by the use of switch -gnatp.
388
389 Suppress_Options.Suppress := (others => False);
390
391 -- Turn off dynamic elaboration checks. SPARK mode depends on the
392 -- use of the static elaboration mode.
393
394 Dynamic_Elaboration_Checks := False;
395
396 -- Detect overflow on unconstrained floating-point types, such as
397 -- the predefined types Float, Long_Float and Long_Long_Float from
398 -- package Standard. Not necessary if float overflows are checked
399 -- (Machine_Overflow true), since appropriate Do_Overflow_Check flags
400 -- will be set in any case.
401
402 Check_Float_Overflow := not Machine_Overflows_On_Target;
403
404 -- Set STRICT mode for overflow checks if not set explicitly. This
405 -- prevents suppressing of overflow checks by default, in code down
406 -- below.
407
408 if Suppress_Options.Overflow_Mode_General = Not_Set then
409 Suppress_Options.Overflow_Mode_General := Strict;
410 Suppress_Options.Overflow_Mode_Assertions := Strict;
411 end if;
412
413 -- Kill debug of generated code, since it messes up sloc values
414
415 Debug_Generated_Code := False;
416
417 -- Turn cross-referencing on in case it was disabled (e.g. by -gnatD)
418 -- as it is needed for computing effects of subprograms in the formal
419 -- verification backend.
420
421 Xref_Active := True;
422
423 -- Polling mode forced off, since it generates confusing junk
424
425 Polling_Required := False;
426
427 -- Set operating mode to Check_Semantics, but a light front-end
428 -- expansion is still performed.
429
430 Operating_Mode := Check_Semantics;
431
432 -- Enable assertions, since they give valuable extra information for
433 -- formal verification.
434
435 Assertions_Enabled := True;
436
437 -- Disable validity checks, since it generates code raising
438 -- exceptions for invalid data, which confuses GNATprove. Invalid
439 -- data is directly detected by GNATprove's flow analysis.
440
441 Validity_Checks_On := False;
442
443 -- Turn off style check options since we are not interested in any
444 -- front-end warnings when we are getting SPARK output.
445
446 Reset_Style_Check_Options;
447
448 -- Suppress the generation of name tables for enumerations, which are
449 -- not needed for formal verification, and fall outside the SPARK
450 -- subset (use of pointers).
451
452 Global_Discard_Names := True;
453
454 -- Suppress the expansion of tagged types and dispatching calls,
455 -- which lead to the generation of non-SPARK code (use of pointers),
456 -- which is more complex to formally verify than the original source.
457
458 Tagged_Type_Expansion := False;
459 end if;
460
461 -- Set Configurable_Run_Time mode if system.ads flag set or if the
462 -- special debug flag -gnatdY is set.
463
464 if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
465 Configurable_Run_Time_Mode := True;
466 end if;
467
468 -- Set -gnatR3m mode if debug flag A set
469
470 if Debug_Flag_AA then
471 Back_Annotate_Rep_Info := True;
472 List_Representation_Info := 1;
473 List_Representation_Info_Mechanisms := True;
474 end if;
475
476 -- Force Target_Strict_Alignment true if debug flag -gnatd.a is set
477
478 if Debug_Flag_Dot_A then
479 Ttypes.Target_Strict_Alignment := True;
480 end if;
481
482 -- Increase size of allocated entities if debug flag -gnatd.N is set
483
484 if Debug_Flag_Dot_NN then
485 Atree.Num_Extension_Nodes := Atree.Num_Extension_Nodes + 1;
486 end if;
487
488 -- Disable static allocation of dispatch tables if -gnatd.t or if layout
489 -- is enabled. The front end's layout phase currently treats types that
490 -- have discriminant-dependent arrays as not being static even when a
491 -- discriminant constraint on the type is static, and this leads to
492 -- problems with subtypes of type Ada.Tags.Dispatch_Table_Wrapper. ???
493
494 if Debug_Flag_Dot_T or else Frontend_Layout_On_Target then
495 Static_Dispatch_Tables := False;
496 end if;
497
498 -- Flip endian mode if -gnatd8 set
499
500 if Debug_Flag_8 then
501 Ttypes.Bytes_Big_Endian := not Ttypes.Bytes_Big_Endian;
502 end if;
503
504 -- Activate front end layout if debug flag -gnatdF is set
505
506 if Debug_Flag_FF then
507 Targparm.Frontend_Layout_On_Target := True;
508 end if;
509
510 -- Set and check exception mechanism
511
512 if Targparm.ZCX_By_Default_On_Target then
513 Exception_Mechanism := Back_End_Exceptions;
514 end if;
515
516 -- Set proper status for overflow check mechanism
517
518 -- If already set (by -gnato or above in SPARK or CodePeer mode) then we
519 -- have nothing to do.
520
521 if Opt.Suppress_Options.Overflow_Mode_General /= Not_Set then
522 null;
523
524 -- Otherwise set overflow mode defaults
525
526 else
527 -- Overflow checks are on by default (Suppress set False) except in
528 -- GNAT_Mode, where we want them off by default (we are not ready to
529 -- enable overflow checks in the compiler yet, for one thing the case
530 -- of 64-bit checks needs System.Arith_64 which is not a compiler
531 -- unit and it is a pain to try to include it in the compiler.
532
533 Suppress_Options.Suppress (Overflow_Check) := GNAT_Mode;
534
535 -- Set appropriate default overflow handling mode. Note: at present
536 -- we set STRICT in all three of the following cases. They are
537 -- separated because in the future we may make different choices.
538
539 -- By default set STRICT mode if -gnatg in effect
540
541 if GNAT_Mode then
542 Suppress_Options.Overflow_Mode_General := Strict;
543 Suppress_Options.Overflow_Mode_Assertions := Strict;
544
545 -- If we have backend divide and overflow checks, then by default
546 -- overflow checks are STRICT. Historically this code used to also
547 -- activate overflow checks, although no target currently has these
548 -- flags set, so this was dead code anyway.
549
550 elsif Targparm.Backend_Divide_Checks_On_Target
551 and
552 Targparm.Backend_Overflow_Checks_On_Target
553 then
554 Suppress_Options.Overflow_Mode_General := Strict;
555 Suppress_Options.Overflow_Mode_Assertions := Strict;
556
557 -- Otherwise for now, default is STRICT mode. This may change in the
558 -- future, but for now this is the compatible behavior with previous
559 -- versions of GNAT.
560
561 else
562 Suppress_Options.Overflow_Mode_General := Strict;
563 Suppress_Options.Overflow_Mode_Assertions := Strict;
564 end if;
565 end if;
566
567 -- Set default for atomic synchronization. As this synchronization
568 -- between atomic accesses can be expensive, and not typically needed
569 -- on some targets, an optional target parameter can turn the option
570 -- off. Note Atomic Synchronization is implemented as check.
571
572 Suppress_Options.Suppress (Atomic_Synchronization) :=
573 not Atomic_Sync_Default_On_Target;
574
575 -- Set default for Alignment_Check, if we are on a machine with non-
576 -- strict alignment, then we suppress this check, since it is over-
577 -- zealous for such machines.
578
579 if not Ttypes.Target_Strict_Alignment then
580 Suppress_Options.Suppress (Alignment_Check) := True;
581 end if;
582
583 -- Set switch indicating if back end can handle limited types, and
584 -- guarantee that no incorrect copies are made (e.g. in the context
585 -- of an if or case expression).
586
587 -- Debug flag -gnatd.L decisively sets usage on
588
589 if Debug_Flag_Dot_LL then
590 Back_End_Handles_Limited_Types := True;
591
592 -- If no debug flag, usage off for AAMP, VM, SCIL cases
593
594 elsif AAMP_On_Target
595 or else VM_Target /= No_VM
596 or else Generate_SCIL
597 then
598 Back_End_Handles_Limited_Types := False;
599
600 -- Otherwise normal gcc back end, for now still turn flag off by
601 -- default, since there are unresolved problems in the front end.
602
603 else
604 Back_End_Handles_Limited_Types := False;
605 end if;
606
607 -- If the inlining level has not been set by the user, compute it from
608 -- the optimization level: 1 at -O1/-O2 (and -Os), 2 at -O3 and above.
609
610 if Inline_Level = 0 then
611 if Optimization_Level < 3 then
612 Inline_Level := 1;
613 else
614 Inline_Level := 2;
615 end if;
616 end if;
617
618 -- Treat -gnatn as equivalent to -gnatN for non-GCC targets
619
620 if Inline_Active and not Front_End_Inlining then
621
622 -- We really should have a tag for this, what if we added a new
623 -- back end some day, it would not be true for this test, but it
624 -- would be non-GCC, so this is a bit troublesome ???
625
626 Front_End_Inlining := VM_Target /= No_VM or else AAMP_On_Target;
627 end if;
628
629 -- Set back end inlining indication
630
631 Back_End_Inlining :=
632
633 -- No back end inlining available for VM targets
634
635 VM_Target = No_VM
636
637 -- No back end inlining available on AAMP
638
639 and then not AAMP_On_Target
640
641 -- No back end inlining in GNATprove mode, since it just confuses
642 -- the formal verification process.
643
644 and then not GNATprove_Mode
645
646 -- No back end inlining if front end inlining explicitly enabled.
647 -- Done to minimize the output differences to customers still using
648 -- this deprecated switch; in addition, this behavior reduces the
649 -- output differences in old tests.
650
651 and then not Front_End_Inlining
652
653 -- Back end inlining is disabled if debug flag .z is set
654
655 and then not Debug_Flag_Dot_Z;
656
657 -- Output warning if -gnateE specified and cannot be supported
658
659 if Exception_Extra_Info
660 and then Restrict.No_Exception_Handlers_Set
661 then
662 Set_Standard_Error;
663 Write_Str
664 ("warning: extra exception information (-gnateE) was specified");
665 Write_Eol;
666 Write_Str
667 ("warning: this capability is not available in this configuration");
668 Write_Eol;
669 Set_Standard_Output;
670 end if;
671
672 -- Finally capture adjusted value of Suppress_Options as the initial
673 -- value for Scope_Suppress, which will be modified as we move from
674 -- scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas).
675
676 Sem.Scope_Suppress := Opt.Suppress_Options;
677 end Adjust_Global_Switches;
678
679 --------------------
680 -- Check_Bad_Body --
681 --------------------
682
683 procedure Check_Bad_Body is
684 Sname : Unit_Name_Type;
685 Src_Ind : Source_File_Index;
686 Fname : File_Name_Type;
687
688 procedure Bad_Body_Error (Msg : String);
689 -- Issue message for bad body found
690
691 --------------------
692 -- Bad_Body_Error --
693 --------------------
694
695 procedure Bad_Body_Error (Msg : String) is
696 begin
697 Error_Msg_N (Msg, Main_Unit_Node);
698 Error_Msg_File_1 := Fname;
699 Error_Msg_N ("remove incorrect body in file{!", Main_Unit_Node);
700 end Bad_Body_Error;
701
702 -- Start of processing for Check_Bad_Body
703
704 begin
705 -- Nothing to do if we are only checking syntax, because we don't know
706 -- enough to know if we require or forbid a body in this case.
707
708 if Operating_Mode = Check_Syntax then
709 return;
710 end if;
711
712 -- Check for body not allowed
713
714 if (Main_Kind = N_Package_Declaration
715 and then not Body_Required (Main_Unit_Node))
716 or else (Main_Kind = N_Generic_Package_Declaration
717 and then not Body_Required (Main_Unit_Node))
718 or else Main_Kind = N_Package_Renaming_Declaration
719 or else Main_Kind = N_Subprogram_Renaming_Declaration
720 or else Nkind (Original_Node (Unit (Main_Unit_Node)))
721 in N_Generic_Instantiation
722 then
723 Sname := Unit_Name (Main_Unit);
724
725 -- If we do not already have a body name, then get the body name
726
727 if not Is_Body_Name (Sname) then
728 Sname := Get_Body_Name (Sname);
729 end if;
730
731 Fname := Get_File_Name (Sname, Subunit => False);
732 Src_Ind := Load_Source_File (Fname);
733
734 -- Case where body is present and it is not a subunit. Exclude the
735 -- subunit case, because it has nothing to do with the package we are
736 -- compiling. It is illegal for a child unit and a subunit with the
737 -- same expanded name (RM 10.2(9)) to appear together in a partition,
738 -- but there is nothing to stop a compilation environment from having
739 -- both, and the test here simply allows that. If there is an attempt
740 -- to include both in a partition, this is diagnosed at bind time. In
741 -- Ada 83 mode this is not a warning case.
742
743 -- Note that in general we do not give the message if the file in
744 -- question does not look like a body. This includes weird cases,
745 -- but in particular means that if the file is just a No_Body pragma,
746 -- then we won't give the message (that's the whole point of this
747 -- pragma, to be used this way and to cause the body file to be
748 -- ignored in this context).
749
750 if Src_Ind /= No_Source_File
751 and then Source_File_Is_Body (Src_Ind)
752 then
753 Errout.Finalize (Last_Call => False);
754
755 Error_Msg_Unit_1 := Sname;
756
757 -- Ada 83 case of a package body being ignored. This is not an
758 -- error as far as the Ada 83 RM is concerned, but it is almost
759 -- certainly not what is wanted so output a warning. Give this
760 -- message only if there were no errors, since otherwise it may
761 -- be incorrect (we may have misinterpreted a junk spec as not
762 -- needing a body when it really does).
763
764 if Main_Kind = N_Package_Declaration
765 and then Ada_Version = Ada_83
766 and then Operating_Mode = Generate_Code
767 and then Distribution_Stub_Mode /= Generate_Caller_Stub_Body
768 and then not Compilation_Errors
769 then
770 Error_Msg_N
771 ("package $$ does not require a body??", Main_Unit_Node);
772 Error_Msg_File_1 := Fname;
773 Error_Msg_N ("body in file{ will be ignored??", Main_Unit_Node);
774
775 -- Ada 95 cases of a body file present when no body is
776 -- permitted. This we consider to be an error.
777
778 else
779 -- For generic instantiations, we never allow a body
780
781 if Nkind (Original_Node (Unit (Main_Unit_Node))) in
782 N_Generic_Instantiation
783 then
784 Bad_Body_Error
785 ("generic instantiation for $$ does not allow a body");
786
787 -- A library unit that is a renaming never allows a body
788
789 elsif Main_Kind in N_Renaming_Declaration then
790 Bad_Body_Error
791 ("renaming declaration for $$ does not allow a body!");
792
793 -- Remaining cases are packages and generic packages. Here
794 -- we only do the test if there are no previous errors,
795 -- because if there are errors, they may lead us to
796 -- incorrectly believe that a package does not allow a
797 -- body when in fact it does.
798
799 elsif not Compilation_Errors then
800 if Main_Kind = N_Package_Declaration then
801 Bad_Body_Error
802 ("package $$ does not allow a body!");
803
804 elsif Main_Kind = N_Generic_Package_Declaration then
805 Bad_Body_Error
806 ("generic package $$ does not allow a body!");
807 end if;
808 end if;
809
810 end if;
811 end if;
812 end if;
813 end Check_Bad_Body;
814
815 --------------------
816 -- Check_Rep_Info --
817 --------------------
818
819 procedure Check_Rep_Info is
820 begin
821 if List_Representation_Info /= 0
822 or else List_Representation_Info_Mechanisms
823 then
824 Set_Standard_Error;
825 Write_Eol;
826 Write_Str
827 ("cannot generate representation information, no code generated");
828 Write_Eol;
829 Write_Eol;
830 Set_Standard_Output;
831 end if;
832 end Check_Rep_Info;
833
834 ----------------------------------------
835 -- Post_Compilation_Validation_Checks --
836 ----------------------------------------
837
838 procedure Post_Compilation_Validation_Checks is
839 begin
840 -- Validate alignment check warnings. In some cases we generate warnings
841 -- about possible alignment errors because we don't know the alignment
842 -- that will be chosen by the back end. This routine is in charge of
843 -- getting rid of those warnings if we can tell they are not needed.
844
845 Checks.Validate_Alignment_Check_Warnings;
846
847 -- Validate unchecked conversions (using the values for size and
848 -- alignment annotated by the backend where possible).
849
850 Sem_Ch13.Validate_Unchecked_Conversions;
851
852 -- Validate address clauses (again using alignment values annotated
853 -- by the backend where possible).
854
855 Sem_Ch13.Validate_Address_Clauses;
856
857 -- Validate independence pragmas (again using values annotated by the
858 -- back end for component layout where possible) but only for non-GCC
859 -- back ends, as this is done a priori for GCC back ends.
860
861 if VM_Target /= No_VM or else AAMP_On_Target then
862 Sem_Ch13.Validate_Independence;
863 end if;
864
865 end Post_Compilation_Validation_Checks;
866
867 -- Start of processing for Gnat1drv
868
869 begin
870 -- This inner block is set up to catch assertion errors and constraint
871 -- errors. Since the code for handling these errors can cause another
872 -- exception to be raised (namely Unrecoverable_Error), we need two
873 -- nested blocks, so that the outer one handles unrecoverable error.
874
875 begin
876 -- Initialize all packages. For the most part, these initialization
877 -- calls can be made in any order. Exceptions are as follows:
878
879 -- Lib.Initialize need to be called before Scan_Compiler_Arguments,
880 -- because it initializes a table filled by Scan_Compiler_Arguments.
881
882 Osint.Initialize;
883 Fmap.Reset_Tables;
884 Lib.Initialize;
885 Lib.Xref.Initialize;
886 Scan_Compiler_Arguments;
887 Osint.Add_Default_Search_Dirs;
888 Atree.Initialize;
889 Nlists.Initialize;
890 Sinput.Initialize;
891 Sem.Initialize;
892 Exp_CG.Initialize;
893 Csets.Initialize;
894 Uintp.Initialize;
895 Urealp.Initialize;
896 Errout.Initialize;
897 SCOs.Initialize;
898 Snames.Initialize;
899 Stringt.Initialize;
900 Ghost.Initialize;
901 Inline.Initialize;
902 Par_SCO.Initialize;
903 Sem_Ch8.Initialize;
904 Sem_Ch12.Initialize;
905 Sem_Ch13.Initialize;
906 Sem_Elim.Initialize;
907 Sem_Eval.Initialize;
908 Sem_Type.Init_Interp_Tables;
909
910 -- Capture compilation date and time
911
912 Opt.Compilation_Time := System.OS_Lib.Current_Time_String;
913
914 -- Get the target parameters only when -gnats is not used, to avoid
915 -- failing when there is no default runtime.
916
917 if Operating_Mode /= Check_Syntax then
918
919 -- Acquire target parameters from system.ads (package System source)
920
921 Targparm_Acquire : declare
922 use Sinput;
923
924 S : Source_File_Index;
925 N : File_Name_Type;
926
927 begin
928 Name_Buffer (1 .. 10) := "system.ads";
929 Name_Len := 10;
930 N := Name_Find;
931 S := Load_Source_File (N);
932
933 -- Failed to read system.ads, fatal error
934
935 if S = No_Source_File then
936 Write_Line
937 ("fatal error, run-time library not installed correctly");
938 Write_Line ("cannot locate file system.ads");
939 raise Unrecoverable_Error;
940
941 -- Read system.ads successfully, remember its source index
942
943 else
944 System_Source_File_Index := S;
945 end if;
946
947 Targparm.Get_Target_Parameters
948 (System_Text => Source_Text (S),
949 Source_First => Source_First (S),
950 Source_Last => Source_Last (S),
951 Make_Id => Tbuild.Make_Id'Access,
952 Make_SC => Tbuild.Make_SC'Access,
953 Set_RND => Tbuild.Set_RND'Access);
954
955 -- Acquire configuration pragma information from Targparm
956
957 Restrict.Restrictions := Targparm.Restrictions_On_Target;
958 end Targparm_Acquire;
959 end if;
960
961 -- Perform various adjustments and settings of global switches
962
963 Adjust_Global_Switches;
964
965 -- Output copyright notice if full list mode unless we have a list
966 -- file, in which case we defer this so that it is output in the file.
967
968 if (Verbose_Mode or else (Full_List and then Full_List_File_Name = null))
969
970 -- Debug flag gnatd7 suppresses this copyright notice
971
972 and then not Debug_Flag_7
973 then
974 Write_Eol;
975 Write_Str ("GNAT ");
976 Write_Str (Gnat_Version_String);
977 Write_Eol;
978 Write_Str ("Copyright 1992-" & Current_Year
979 & ", Free Software Foundation, Inc.");
980 Write_Eol;
981 end if;
982
983 -- Check we do not have more than one source file, this happens only in
984 -- the case where the driver is called directly, it cannot happen when
985 -- gnat1 is invoked from gcc in the normal case.
986
987 if Osint.Number_Of_Files /= 1 then
988 Usage;
989 Write_Eol;
990 Osint.Fail ("you must provide one source file");
991
992 elsif Usage_Requested then
993 Usage;
994 end if;
995
996 -- Generate target dependent output file if requested
997
998 if Target_Dependent_Info_Write_Name /= null then
999 Set_Targ.Write_Target_Dependent_Values;
1000 end if;
1001
1002 -- Call the front end
1003
1004 Original_Operating_Mode := Operating_Mode;
1005 Frontend;
1006
1007 -- Exit with errors if the main source could not be parsed.
1008
1009 if Sinput.Main_Source_File = No_Source_File then
1010 Errout.Finalize (Last_Call => True);
1011 Errout.Output_Messages;
1012 Exit_Program (E_Errors);
1013 end if;
1014
1015 Main_Unit_Node := Cunit (Main_Unit);
1016 Main_Kind := Nkind (Unit (Main_Unit_Node));
1017 Check_Bad_Body;
1018
1019 -- In CodePeer mode we always delete old SCIL files before regenerating
1020 -- new ones, in case of e.g. errors, and also to remove obsolete scilx
1021 -- files generated by CodePeer itself.
1022
1023 if CodePeer_Mode then
1024 Comperr.Delete_SCIL_Files;
1025 end if;
1026
1027 -- Exit if compilation errors detected
1028
1029 Errout.Finalize (Last_Call => False);
1030
1031 if Compilation_Errors then
1032 Treepr.Tree_Dump;
1033 Post_Compilation_Validation_Checks;
1034 Errout.Output_Messages;
1035 Namet.Finalize;
1036
1037 -- Generate ALI file if specially requested
1038
1039 if Opt.Force_ALI_Tree_File then
1040 Write_ALI (Object => False);
1041 Tree_Gen;
1042 end if;
1043
1044 Errout.Finalize (Last_Call => True);
1045 Exit_Program (E_Errors);
1046 end if;
1047
1048 -- Set Generate_Code on main unit and its spec. We do this even if are
1049 -- not generating code, since Lib-Writ uses this to determine which
1050 -- units get written in the ali file.
1051
1052 Set_Generate_Code (Main_Unit);
1053
1054 -- If we have a corresponding spec, and it comes from source or it is
1055 -- not a generated spec for a child subprogram body, then we need object
1056 -- code for the spec unit as well.
1057
1058 if Nkind (Unit (Main_Unit_Node)) in N_Unit_Body
1059 and then not Acts_As_Spec (Main_Unit_Node)
1060 then
1061 if Nkind (Unit (Main_Unit_Node)) = N_Subprogram_Body
1062 and then not Comes_From_Source (Library_Unit (Main_Unit_Node))
1063 then
1064 null;
1065 else
1066 Set_Generate_Code
1067 (Get_Cunit_Unit_Number (Library_Unit (Main_Unit_Node)));
1068 end if;
1069 end if;
1070
1071 -- Case of no code required to be generated, exit indicating no error
1072
1073 if Original_Operating_Mode = Check_Syntax then
1074 Treepr.Tree_Dump;
1075 Errout.Finalize (Last_Call => True);
1076 Errout.Output_Messages;
1077 Tree_Gen;
1078 Namet.Finalize;
1079 Check_Rep_Info;
1080
1081 -- Use a goto instead of calling Exit_Program so that finalization
1082 -- occurs normally.
1083
1084 goto End_Of_Program;
1085
1086 elsif Original_Operating_Mode = Check_Semantics then
1087 Back_End_Mode := Declarations_Only;
1088
1089 -- All remaining cases are cases in which the user requested that code
1090 -- be generated (i.e. no -gnatc or -gnats switch was used). Check if we
1091 -- can in fact satisfy this request.
1092
1093 -- Cannot generate code if someone has turned off code generation for
1094 -- any reason at all. We will try to figure out a reason below.
1095
1096 elsif Operating_Mode /= Generate_Code then
1097 Back_End_Mode := Skip;
1098
1099 -- We can generate code for a subprogram body unless there were missing
1100 -- subunits. Note that we always generate code for all generic units (a
1101 -- change from some previous versions of GNAT).
1102
1103 elsif Main_Kind = N_Subprogram_Body and then not Subunits_Missing then
1104 Back_End_Mode := Generate_Object;
1105
1106 -- We can generate code for a package body unless there are subunits
1107 -- missing (note that we always generate code for generic units, which
1108 -- is a change from some earlier versions of GNAT).
1109
1110 elsif Main_Kind = N_Package_Body and then not Subunits_Missing then
1111 Back_End_Mode := Generate_Object;
1112
1113 -- We can generate code for a package declaration or a subprogram
1114 -- declaration only if it does not required a body.
1115
1116 elsif Nkind_In (Main_Kind,
1117 N_Package_Declaration,
1118 N_Subprogram_Declaration)
1119 and then
1120 (not Body_Required (Main_Unit_Node)
1121 or else
1122 Distribution_Stub_Mode = Generate_Caller_Stub_Body)
1123 then
1124 Back_End_Mode := Generate_Object;
1125
1126 -- We can generate code for a generic package declaration of a generic
1127 -- subprogram declaration only if does not require a body.
1128
1129 elsif Nkind_In (Main_Kind, N_Generic_Package_Declaration,
1130 N_Generic_Subprogram_Declaration)
1131 and then not Body_Required (Main_Unit_Node)
1132 then
1133 Back_End_Mode := Generate_Object;
1134
1135 -- Compilation units that are renamings do not require bodies, so we can
1136 -- generate code for them.
1137
1138 elsif Nkind_In (Main_Kind, N_Package_Renaming_Declaration,
1139 N_Subprogram_Renaming_Declaration)
1140 then
1141 Back_End_Mode := Generate_Object;
1142
1143 -- Compilation units that are generic renamings do not require bodies
1144 -- so we can generate code for them.
1145
1146 elsif Main_Kind in N_Generic_Renaming_Declaration then
1147 Back_End_Mode := Generate_Object;
1148
1149 -- It is not an error to analyze in CodePeer mode a spec which requires
1150 -- a body, in order to generate SCIL for this spec.
1151
1152 elsif CodePeer_Mode then
1153 Back_End_Mode := Generate_Object;
1154
1155 -- It is not an error to analyze in GNATprove mode a spec which requires
1156 -- a body, when the body is not available. During frame condition
1157 -- generation, the corresponding ALI file is generated. During
1158 -- analysis, the spec is analyzed.
1159
1160 elsif GNATprove_Mode then
1161 Back_End_Mode := Declarations_Only;
1162
1163 -- In all other cases (specs which have bodies, generics, and bodies
1164 -- where subunits are missing), we cannot generate code and we generate
1165 -- a warning message. Note that generic instantiations are gone at this
1166 -- stage since they have been replaced by their instances.
1167
1168 else
1169 Back_End_Mode := Skip;
1170 end if;
1171
1172 -- At this stage Back_End_Mode is set to indicate if the backend should
1173 -- be called to generate code. If it is Skip, then code generation has
1174 -- been turned off, even though code was requested by the original
1175 -- command. This is not an error from the user point of view, but it is
1176 -- an error from the point of view of the gcc driver, so we must exit
1177 -- with an error status.
1178
1179 -- We generate an informative message (from the gcc point of view, it
1180 -- is an error message, but from the users point of view this is not an
1181 -- error, just a consequence of compiling something that cannot
1182 -- generate code).
1183
1184 if Back_End_Mode = Skip then
1185 Set_Standard_Error;
1186 Write_Str ("cannot generate code for ");
1187 Write_Str ("file ");
1188 Write_Name (Unit_File_Name (Main_Unit));
1189
1190 if Subunits_Missing then
1191 Write_Str (" (missing subunits)");
1192 Write_Eol;
1193
1194 -- Force generation of ALI file, for backward compatibility
1195
1196 Opt.Force_ALI_Tree_File := True;
1197
1198 elsif Main_Kind = N_Subunit then
1199 Write_Str (" (subunit)");
1200 Write_Eol;
1201
1202 -- Force generation of ALI file, for backward compatibility
1203
1204 Opt.Force_ALI_Tree_File := True;
1205
1206 elsif Main_Kind = N_Subprogram_Declaration then
1207 Write_Str (" (subprogram spec)");
1208 Write_Eol;
1209
1210 -- Generic package body in GNAT implementation mode
1211
1212 elsif Main_Kind = N_Package_Body and then GNAT_Mode then
1213 Write_Str (" (predefined generic)");
1214 Write_Eol;
1215
1216 -- Force generation of ALI file, for backward compatibility
1217
1218 Opt.Force_ALI_Tree_File := True;
1219
1220 -- Only other case is a package spec
1221
1222 else
1223 Write_Str (" (package spec)");
1224 Write_Eol;
1225 end if;
1226
1227 Set_Standard_Output;
1228
1229 Post_Compilation_Validation_Checks;
1230 Errout.Finalize (Last_Call => True);
1231 Errout.Output_Messages;
1232 Treepr.Tree_Dump;
1233 Tree_Gen;
1234
1235 -- Generate ALI file if specially requested, or for missing subunits,
1236 -- subunits or predefined generic.
1237
1238 if Opt.Force_ALI_Tree_File then
1239 Write_ALI (Object => False);
1240 end if;
1241
1242 Namet.Finalize;
1243 Check_Rep_Info;
1244
1245 -- Exit program with error indication, to kill object file
1246
1247 Exit_Program (E_No_Code);
1248 end if;
1249
1250 -- In -gnatc mode, we only do annotation if -gnatt or -gnatR is also set
1251 -- as indicated by Back_Annotate_Rep_Info being set to True.
1252
1253 -- We don't call for annotations on a subunit, because to process those
1254 -- the back-end requires that the parent(s) be properly compiled.
1255
1256 -- Annotation is suppressed for targets where front-end layout is
1257 -- enabled, because the front end determines representations.
1258
1259 -- Annotation is also suppressed in the case of compiling for a VM,
1260 -- since representations are largely symbolic there.
1261
1262 if Back_End_Mode = Declarations_Only
1263 and then
1264 (not (Back_Annotate_Rep_Info or Generate_SCIL or GNATprove_Mode)
1265 or else Main_Kind = N_Subunit
1266 or else Frontend_Layout_On_Target
1267 or else VM_Target /= No_VM)
1268 then
1269 Post_Compilation_Validation_Checks;
1270 Errout.Finalize (Last_Call => True);
1271 Errout.Output_Messages;
1272 Write_ALI (Object => False);
1273 Tree_Dump;
1274 Tree_Gen;
1275 Namet.Finalize;
1276 Check_Rep_Info;
1277 return;
1278 end if;
1279
1280 -- Ensure that we properly register a dependency on system.ads, since
1281 -- even if we do not semantically depend on this, Targparm has read
1282 -- system parameters from the system.ads file.
1283
1284 Lib.Writ.Ensure_System_Dependency;
1285
1286 -- Add dependencies, if any, on preprocessing data file and on
1287 -- preprocessing definition file(s).
1288
1289 Prepcomp.Add_Dependencies;
1290
1291 -- In gnatprove mode we're writing the ALI much earlier than usual
1292 -- as flow analysis needs the file present in order to append its
1293 -- own globals to it.
1294
1295 if GNATprove_Mode then
1296
1297 -- Note: In GNATprove mode, an "object" file is always generated as
1298 -- the result of calling gnat1 or gnat2why, although this is not the
1299 -- same as the object file produced for compilation.
1300
1301 Write_ALI (Object => True);
1302 end if;
1303
1304 -- Some back ends (for instance Gigi) are known to rely on SCOs for code
1305 -- generation. Make sure they are available.
1306
1307 if Generate_SCO then
1308 Par_SCO.SCO_Record_Filtered;
1309 end if;
1310
1311 -- Back end needs to explicitly unlock tables it needs to touch
1312
1313 Atree.Lock;
1314 Elists.Lock;
1315 Fname.UF.Lock;
1316 Ghost.Lock;
1317 Inline.Lock;
1318 Lib.Lock;
1319 Namet.Lock;
1320 Nlists.Lock;
1321 Sem.Lock;
1322 Sinput.Lock;
1323 Stringt.Lock;
1324
1325 -- Here we call the back end to generate the output code
1326
1327 Generating_Code := True;
1328 Back_End.Call_Back_End (Back_End_Mode);
1329
1330 -- Once the backend is complete, we unlock the names table. This call
1331 -- allows a few extra entries, needed for example for the file name for
1332 -- the library file output.
1333
1334 Namet.Unlock;
1335
1336 -- Generate the call-graph output of dispatching calls
1337
1338 Exp_CG.Generate_CG_Output;
1339
1340 -- Perform post compilation validation checks
1341
1342 Post_Compilation_Validation_Checks;
1343
1344 -- Now we complete output of errors, rep info and the tree info. These
1345 -- are delayed till now, since it is perfectly possible for gigi to
1346 -- generate errors, modify the tree (in particular by setting flags
1347 -- indicating that elaboration is required, and also to back annotate
1348 -- representation information for List_Rep_Info.
1349
1350 Errout.Finalize (Last_Call => True);
1351 Errout.Output_Messages;
1352 List_Rep_Info (Ttypes.Bytes_Big_Endian);
1353 Inline.List_Inlining_Info;
1354
1355 -- Only write the library if the backend did not generate any error
1356 -- messages. Otherwise signal errors to the driver program so that
1357 -- there will be no attempt to generate an object file.
1358
1359 if Compilation_Errors then
1360 Treepr.Tree_Dump;
1361 Exit_Program (E_Errors);
1362 end if;
1363
1364 if not GNATprove_Mode then
1365 Write_ALI (Object => (Back_End_Mode = Generate_Object));
1366 end if;
1367
1368 if not Compilation_Errors then
1369
1370 -- In case of ada backends, we need to make sure that the generated
1371 -- object file has a timestamp greater than the ALI file. We do this
1372 -- to make gnatmake happy when checking the ALI and obj timestamps,
1373 -- where it expects the object file being written after the ali file.
1374
1375 -- Gnatmake's assumption is true for gcc platforms where the gcc
1376 -- wrapper needs to call the assembler after calling gnat1, but is
1377 -- not true for ada backends, where the object files are created
1378 -- directly by gnat1 (so are created before the ali file).
1379
1380 Back_End.Gen_Or_Update_Object_File;
1381 end if;
1382
1383 -- Generate ASIS tree after writing the ALI file, since in ASIS mode,
1384 -- Write_ALI may in fact result in further tree decoration from the
1385 -- original tree file. Note that we dump the tree just before generating
1386 -- it, so that the dump will exactly reflect what is written out.
1387
1388 Treepr.Tree_Dump;
1389 Tree_Gen;
1390
1391 -- Finalize name table and we are all done
1392
1393 Namet.Finalize;
1394
1395 exception
1396 -- Handle fatal internal compiler errors
1397
1398 when Rtsfind.RE_Not_Available =>
1399 Comperr.Compiler_Abort ("RE_Not_Available");
1400
1401 when System.Assertions.Assert_Failure =>
1402 Comperr.Compiler_Abort ("Assert_Failure");
1403
1404 when Constraint_Error =>
1405 Comperr.Compiler_Abort ("Constraint_Error");
1406
1407 when Program_Error =>
1408 Comperr.Compiler_Abort ("Program_Error");
1409
1410 when Storage_Error =>
1411
1412 -- Assume this is a bug. If it is real, the message will in any case
1413 -- say Storage_Error, giving a strong hint.
1414
1415 Comperr.Compiler_Abort ("Storage_Error");
1416 end;
1417
1418 <<End_Of_Program>>
1419 null;
1420
1421 -- The outer exception handles an unrecoverable error
1422
1423 exception
1424 when Unrecoverable_Error =>
1425 Errout.Finalize (Last_Call => True);
1426 Errout.Output_Messages;
1427
1428 Set_Standard_Error;
1429 Write_Str ("compilation abandoned");
1430 Write_Eol;
1431
1432 Set_Standard_Output;
1433 Source_Dump;
1434 Tree_Dump;
1435 Exit_Program (E_Errors);
1436
1437 end Gnat1drv;