Debian Codegraph @

source_2012/safety.mss

raw
1 @Comment{ $Source: e:\\cvsroot/ARM/Source/safety.mss,v $ }
2 @Comment{ $Revision: 1.59 $ $Date: 2012/11/28 23:53:06 $ $Author: randy $ }
3 @Part(safety, Root="ada.mss")
4
5 @Comment{$Date: 2012/11/28 23:53:06 $}
6 @LabeledRevisedNormativeAnnex{Version=[2],
7 New=[High Integrity Systems], Old=[Safety and Security]}
8
9 @begin{Intro}
10 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00347-01]}
11 @Leading@Defn{safety-critical systems}
12 @Defn{secure systems}
13 This Annex addresses requirements for @Chg{Version=[2],
14 New=[high integrity ],Old=[]}systems @Chg{Version=[2],New=[(including],
15 Old=[that are]} safety@Chg{Version=[2],New=[-],Old=[ ]}critical
16 @Chg{Version=[2],New=[systems and],Old=[or have]}
17 security@Chg{Version=[2],New=[-critical systems)],Old=[ constraints]}. It
18 provides facilities and specifies documentation requirements that relate to
19 several needs:
20 @begin{Itemize}
21 Understanding program execution;
22
23 Reviewing object code;
24
25 Restricting language constructs whose usage might
26 complicate the demonstration of program correctness
27 @end{Itemize}
28 @ChgNote{The following paragraph is missing a number in the original version.
29 To give it a number in the new version, it is marked as an insertion.}
30 @ChgRef{Version=[0],Kind=[Added]}
31 @Chg{New=[],Old=[@Noparanum@;]}Execution understandability
32 is supported by pragma Normalize_Scalars, and also by
33 requirements for the implementation to document the effect of a program
34 in the presence of a bounded error or where the language rules leave
35 the effect unspecified.
36 @PDefn{unspecified}
37
38 The @nt[pragma]s Reviewable and Restrictions relate to the other
39 requirements addressed by this Annex.
40 @end{Intro}
41
42 @begin{Notes}
43 The @attr[Valid] attribute (see @RefSecNum(The Valid Attribute)) is
44 also useful in addressing these needs,
45 to avoid problems that could otherwise arise from scalars
46 that have values outside their declared range constraints.
47 @begin{Discussion}
48
49 The Annex tries to provide high assurance rather than language features.
50 However, it is not possible, in general, to test for high assurance. For any
51 specific language feature, it is possible to demonstrate its presence by a
52 functional test, as in the ACVC. One can also check for the presence of some
53 documentation requirements, but it is not easy to determine objectively that
54 the documentation is @lquotes@;adequate@rquotes@;.
55
56 @end{Discussion}
57 @end{Notes}
58
59 @begin{Extend83}
60 @Defn{extensions to Ada 83}
61 This Annex is new to Ada 95.
62 @end{Extend83}
63
64 @begin{DiffWord95}
65 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
66 @ChgAdded{Version=[2],Text=[The title of this annex was changed to better
67 reflect its purpose and scope. High integrity systems has become the standard
68 way of identifying systems that have high reliability requirements; it
69 subsumes terms such as safety and security. Moreover, the annex does not
70 include any security specific features and as such the previous title is
71 somewhat misleading.]}
72 @end{DiffWord95}
73
74 @LabeledClause{Pragma Normalize_Scalars}
75 @begin{Intro}
76 This pragma ensures that an otherwise
77 uninitialized scalar object is set to a
78 predictable value, but out of range if possible.
79 @begin[discussion]
80 The goal of the pragma is to reduce the impact of a bounded error
81 that results from a reference to an uninitialized scalar object, by
82 having such a reference violate a range check and thus raise
83 Constraint_Error.
84 @end[discussion]
85 @end{Intro}
86
87 @begin{Syntax}
88 @begin{SyntaxText}
89 @Leading@Keepnext@;The form of a @nt{pragma} Normalize_Scalars is as follows:
90 @end{SyntaxText}
91
92 @PragmaSyn`@key{pragma} @prag(Normalize_Scalars);'
93 @end{Syntax}
94
95 @begin{LinkTime}
96 @PDefn2{Term=[configuration pragma], Sec=(Normalize_Scalars)}
97 @PDefn2{Term=[pragma, configuration], Sec=(Normalize_Scalars)}
98 Pragma Normalize_Scalars is a configuration pragma.
99 It applies to all
100 @nt[compilation_unit]s included in a partition.
101 @end{LinkTime}
102
103 @begin{DocReq}
104 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
105 If a @nt{pragma} Normalize_Scalars applies,
106 the implementation shall document the implicit initial @Chg{Version=[2],
107 New=[values],Old=[value]} for scalar subtypes,
108 and shall identify each case in which such a value is used
109 and is not an invalid representation.
110 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[If
111 a @nt{pragma} Normalize_Scalars applies, the implicit initial values of
112 scalar subtypes shall be documented. Such a value should be an
113 invalid representation when possible; any cases when is it not shall be
114 documented.]}]}
115 @begin{Honest}
116 It's slightly inaccurate to say that the value is a
117 representation, but the point should be clear anyway.
118 @end{Honest}
119 @begin{Discussion}
120
121 By providing a type with a size specification so that spare bits are
122 present, it is possible to force an implementation of Normalize_Scalars to use
123 an out of range value. This can be tested for by ensuring that
124 Constraint_Error is raised. Similarly, for an unconstrained integer type, in
125 which no spare bit is surely present, one can check that the initialization
126 takes place to the value specified in the documentation of the
127 implementation. For a floating point type, spare bits might not
128 be available, but a range constraint can provide the ability to use an out
129 of range value.
130
131 If it is difficult to document the general rule for the implicit initial
132 value, the implementation might choose instead to record the value on
133 the object code listing or similar output produced during compilation.
134
135 @end{Discussion}
136 @end{DocReq}
137
138 @begin{ImplAdvice}
139 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
140 Whenever possible, the implicit initial @Chg{Version=[2],
141 New=[values],Old=[value]} for a scalar subtype
142 should be an invalid representation
143 (see @RefSecNum{Data Validity}).
144 @begin{Discussion}
145
146 When an out of range value is used for the initialization,
147 it is likely that constraint checks will detect it.
148 In addition, it can be detected by the Valid attribute.
149
150 @ChgRef{Version=[2],Kind=[AddedNormal]}
151 @ChgAdded{Version=[2],Text=[This rule is included in the documentation
152 requirements, and thus does not need a separate summary item.]}
153
154 @end{Discussion}
155 @end{ImplAdvice}
156
157 @begin{Notes}
158 The initialization requirement applies to
159 uninitialized scalar objects that are subcomponents of composite
160 objects, to allocated objects, and to stand-alone objects. It also
161 applies to scalar @key{out} parameters. Scalar
162 subcomponents of composite @key{out} parameters are initialized to the
163 corresponding part of the actual, by virtue of
164 @RefSecNum(Parameter Associations).
165
166 The initialization requirement does not apply to a scalar for which
167 pragma Import has been specified,
168 since initialization of an imported object is performed
169 solely by the foreign language environment
170 (see @RefSecNum[Interfacing Aspects]).
171
172 The use of pragma Normalize_Scalars in conjunction with
173 Pragma Restrictions(No_Exceptions) may result in erroneous execution
174 (see @RefSecNum[High Integrity Restrictions]).
175 @begin{Discussion}
176
177 Since the effect of an access to an out of range value will often be to
178 raise Constraint_Error, it is clear that suppressing the exception mechanism
179 could result in erroneous execution. In particular, the assignment to an
180 array, with the array index out of range, will result in a write to an
181 arbitrary store location, having unpredictable effects.
182
183 @end{Discussion}
184 @end{Notes}
185
186 @LabeledClause{Documentation of Implementation Decisions}
187
188 @begin{DocReq}
189 @PDefn{unspecified}
190 The implementation shall document the range of effects for each
191 situation that the language rules identify as either a
192 bounded error or as having an unspecified effect.
193 If the implementation can constrain the effects of erroneous
194 execution for a given construct,
195 then it shall document such constraints.
196 @Redundant[The documentation might be provided either
197 independently of any compilation unit or partition, or as part of an annotated
198 listing for a given unit or partition.
199 See also @RefSecNum(Conformity of an Implementation with the Standard), and
200 @RefSecNum(Structure).]
201 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
202 Text=[@ChgDeleted{Version=[2],
203 Text=[Information regarding bounded errors and erroneous execution.]}]}
204 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
205 The range of effects for each bounded error and each unspecified effect.
206 If the effects of a given erroneous construct are
207 constrained, the constraints shall be documented.]}]}
208
209 @end{DocReq}
210
211 @begin{Notes}
212 Among the situations to be
213 documented are the conventions
214 chosen for parameter passing, the methods used for the management of
215 run-time storage, and the method used to evaluate numeric expressions if
216 this involves extended range or extra precision.
217 @begin{Discussion}
218
219 Look up @lquotes@;unspecified@rquotes@; and @lquotes@;erroneous execution@rquotes@;
220 in the index for a list of the cases.
221
222 The management of run-time storage is particularly important. For safety
223 applications, it is often necessary to show that a program cannot raise
224 Storage_Error, and for security applications that information cannot leak
225 via the run-time system. Users are likely to prefer a simple storage model
226 that can be easily validated.
227
228 The documentation could helpfully take into account that users may well
229 adopt a subset to avoid some forms of erroneous execution, for instance, not
230 using the abort statement, so that the effects of a partly completed
231 @nt{assignment_statement} do not have to be considered in the validation of a
232 program
233 (see @RefSecNum{Abort of a Task - Abort of a Sequence of Statements}).
234 For this reason documentation linked to an actual compilation may be
235 most useful. Similarly, an implementation may be able to take into
236 account use of the Restrictions pragma.
237
238 @end{Discussion}
239 @end{Notes}
240
241
242 @LabeledClause{Reviewable Object Code}
243
244 @begin{Intro}
245 Object code review and validation are supported by
246 pragmas Reviewable and Inspection_Point.
247 @end{Intro}
248
249 @LabeledSubClause{Pragma Reviewable}
250 @begin{Intro}
251 This pragma directs the implementation to
252 provide information to
253 facilitate analysis and review of a program's
254 object code, in particular to allow determination of
255 execution time and storage usage and to identify the
256 correspondence between the source and object programs.
257 @begin{Discussion}
258
259 Since the purpose of this pragma is to provide information to the user,
260 it is hard to objectively test for conformity. In practice, users want
261 the information in an easily understood and convenient form, but neither
262 of these properties can be easily measured.
263
264 @end{Discussion}
265 @end{Intro}
266
267 @begin{Syntax}
268 @begin{SyntaxText}
269 @Leading@Keepnext@;The form of a @nt{pragma} Reviewable is as follows:
270 @end{SyntaxText}
271
272 @PragmaSyn`@key{pragma} @prag(Reviewable);'
273 @end{Syntax}
274
275 @begin{LinkTime}
276 @PDefn2{Term=[configuration pragma], Sec=(Reviewable)}
277 @PDefn2{Term=[pragma, configuration], Sec=(Reviewable)}
278 Pragma Reviewable is a configuration pragma.
279 It applies to all
280 @nt[compilation_unit]s included in a partition.
281 @end{LinkTime}
282
283 @begin{ImplReq}
284 @Leading@;The implementation shall provide the following
285 information for any compilation unit to which such a
286 pragma applies:
287 @begin{Discussion}
288
289 The list of requirements can be checked for, even if issues like
290 intelligibility are not addressed.
291
292 @end{Discussion}
293 @begin{itemize}
294 Where compiler-generated run-time checks remain;
295 @begin{Discussion}
296
297 A constraint check which is implemented via a check on the upper and lower
298 bound should clearly be indicated. If a check is implicit in the form of
299 machine instructions used (such an overflow checking), this should also be
300 covered by the documentation. It is particularly important to cover those
301 checks which are not obvious from the source code, such as that for stack
302 overflow.
303
304 @end{Discussion}
305
306 An identification of any construct with a language-defined check
307 that is recognized prior to run time as certain to fail
308 if executed
309 (even if the generation of run-time checks has been suppressed);
310 @begin{Discussion}
311
312 In this case, if the compiler determines that a check must fail, the user
313 should be informed of this. However, since it is not in general possible to
314 know what the compiler will detect, it is not easy to test for this. In
315 practice, it is thought that compilers claiming conformity to this Annex
316 will perform significant optimizations and therefore @i{will} detect such
317 situations. Of course, such events could well indicate a programmer error.
318
319 @end{Discussion}
320
321 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
322 For each @Chg{Version=[2],New=[read of],Old=[reference to]} a scalar object,
323 an identification of the @Chg{Version=[2],New=[read],Old=[reference]} as
324 either @lquotes@;known to be initialized,@rquotes@; or
325 @lquotes@;possibly uninitialized,@rquotes@;
326 independent of whether pragma Normalize_Scalars applies;
327 @begin{Discussion}
328
329 This issue again raises the question as to what the compiler has determined.
330 A lazy implementation could clearly mark all scalars as @lquotes@;possibly
331 uninitialized@rquotes@;, but this would be very unhelpful to the user. It should be
332 possible to analyze a range of scalar uses and note the percentage in each
333 class. Note that an access marked @lquotes@;known to be initialized@rquotes@; does not imply
334 that the value is in range, since the initialization could be from an
335 (erroneous) call of unchecked conversion, or by means external to the Ada
336 program.
337
338 @end{Discussion}
339
340 Where run-time support routines are implicitly invoked;
341 @begin{Discussion}
342
343 Validators will need to know the calls invoked in order to check for the
344 correct functionality. For instance, for some safety applications, it may be
345 necessary to ensure that certain sections of code can execute in a
346 particular time.
347
348 @end{Discussion}
349
350 @Leading@Keepnext@;An object code listing, including:
351 @begin{inneritemize}
352 Machine instructions, with relative offsets;
353 @begin{Discussion}
354
355 The machine instructions should be in a format that is easily understood,
356 such as the symbolic format of the assembler. The relative offsets are
357 needed in numeric format, to check any alignment restrictions that the
358 architecture might impose.
359
360 @end{Discussion}
361
362 Where each data object is stored during its lifetime;
363 @begin{Discussion}
364
365 This requirement implies that if the optimizer assigns a variable to a
366 register, this needs to be evident.
367
368 @end{Discussion}
369
370 Correspondence with the source program, including an identification of the
371 code produced per declaration and per statement.
372 @begin{Discussion}
373
374 This correspondence will be quite complex when extensive optimization is
375 performed. In particular, address calculation to access some data structures
376 could be moved from the actual access. However, when all the machine code
377 arising from a statement or declaration is in one basic block, this must be
378 indicated by the implementation.
379
380 @end{Discussion}
381 @end{inneritemize}
382
383 An identification of each construct for which the implementation detects
384 the possibility of erroneous execution;
385 @begin{Discussion}
386
387 This requirement is quite vague. In general, it is hard for compilers to detect
388 erroneous execution and therefore the requirement will be rarely invoked. However,
389 if the pragma Suppress is used and the compiler can show that a predefined
390 exception will be raised, then such an identification would be useful.
391
392 @end{Discussion}
393
394 @Trailing@;For each subprogram, block, task,
395 or other construct implemented by
396 reserving and subsequently freeing an area on a run-time stack,
397 an identification
398 of the length of the fixed-size portion of the area and an indication
399 of whether the non-fixed size portion is reserved on the stack
400 or in a dynamically-managed storage region.
401 @begin{Discussion}
402 This requirement is vital for those requiring to show that the storage
403 available to a program is sufficient. This is crucial in those cases in
404 which the internal checks for stack overflow are suppressed (perhaps by
405 @key[pragma] Restrictions(No_Exceptions)).
406 @end{Discussion}
407 @end{itemize}
408
409 @Leading@;The implementation shall provide the following
410 information for any partition to which the
411 pragma applies:
412 @begin{Itemize}
413 An object code listing of the entire partition, including
414 initialization and finalization code as well as
415 run-time
416 system components, and with an identification of those instructions and
417 data that will be relocated at load time;
418 @begin{Discussion}
419 The object code listing should enable a validator to estimate
420 upper bounds for the time taken by critical parts of a program.
421 Similarly, by an analysis of the entire partition, it should be possible
422 to ensure that the storage requirements are suitably bounded,
423 assuming that the partition was written in an appropriate
424 manner.@end{discussion}
425
426 A description of the run-time model relevant to the partition.
427 @begin{Discussion}
428 For example,
429 a description of the storage model is vital,
430 since the Ada language does not explicitly define such a model.
431 @end{Discussion}
432 @end{itemize}
433 @end{ImplReq}
434
435 @Chgnote{The following paragraph is missing a number in the original version.
436 To give it a number in the new version, it is marked as an insertion.}
437 @ChgRef{Version=[0],Kind=[Added]}
438 @Chg{New=[],Old=[@Noparanum@;]}The implementation shall provide control- and data-flow
439 information, both within each compilation unit and across
440 the compilation units of the partition.
441 @begin{Discussion}
442
443 This requirement is quite vague, since it is unclear what control and data
444 flow information the compiler has produced. It is really a plea not to throw
445 away information that could be useful to the validator. Note that the data
446 flow information is relevant to the detection of @lquotes@;possibly uninitialized@rquotes@;
447 objects referred to above.
448
449 @end{Discussion}
450 @begin{ImplAdvice}
451 The implementation should provide the above
452 information in both a human-readable
453 and machine-readable form,
454 and should document the latter so as to ease further
455 processing by automated tools.
456 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
457 Text=[The information produced by @nt{pragma} Reviewable should be
458 provided in both a human-readable and machine-readable form, and the
459 latter form should be documented.]}]}
460
461 Object code listings should be provided both in a symbolic
462 format and also in an appropriate numeric format (such as
463 hexadecimal or octal).
464 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
465 Text=[Object code listings should be provided both in a symbolic
466 format and in a numeric format.]}]}
467 @begin{Reason}
468
469 This is to enable other tools to perform any analysis that the user
470 needed to aid validation.
471 The format should be in some agreed form.
472
473 @end{Reason}
474 @end{ImplAdvice}
475
476 @begin{Notes}
477 The order of elaboration of library units will be documented
478 even in the absence of @nt[pragma] Reviewable
479 (see @RefSecNum{Program Execution}).
480 @end{Notes}
481
482 @begin[discussion]
483 There might be some interactions between pragma Reviewable and compiler
484 optimizations. For example,
485 an implementation may disable some
486 optimizations when pragma Reviewable is in force
487 if it would be overly complicated to
488 provide
489 the detailed information to allow review of the optimized object code.
490 See also @nt<pragma> Optimize (@RefSecNum{Pragmas}).
491 @end[discussion]
492
493 @begin{DiffWord95}
494 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00209-01]}
495 @ChgAdded{Version=[2],Text=[The wording was clarified that pragma Reviewable
496 applies to each read of an object, as it makes no sense to talk about the
497 state of an object that will immediately be overwritten.]}
498 @end{DiffWord95}
499
500 @LabeledSubClause{Pragma Inspection_Point}
501 @begin{Intro}
502 An occurrence of a pragma Inspection_Point identifies a set of objects each of
503 whose values is to be
504 available at the point(s) during program execution corresponding to the
505 position of the pragma in the compilation unit.
506 The purpose of such a pragma is to facilitate code validation.
507 @begin{Discussion}
508
509 Inspection points are a high level equivalent of break points used by
510 debuggers.
511
512 @end{Discussion}
513 @end{Intro}
514
515 @begin{Syntax}
516 @begin{SyntaxText}
517 @Leading@Keepnext@;The form of a @nt{pragma} Inspection_Point is as follows:
518 @end{SyntaxText}
519
520 @PragmaSyn`@key{pragma} @prag(Inspection_Point)[(@SynI{object_}@Syn2{name} {, @SynI{object_}@Syn2{name}})];'
521 @end{Syntax}
522
523 @begin{Legality}
524 A pragma Inspection_Point is allowed wherever a
525 @nt[declarative_item]
526 or @nt[statement] is allowed.
527 Each @SynI{object_}name shall statically denote the declaration of an object.
528 @begin{Discussion}
529
530 The static denotation is required, since no dynamic evaluation of a name
531 is involved in this pragma.
532
533 @end{Discussion}
534 @end{Legality}
535
536 @begin{StaticSem}
537 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
538 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
539 @Defn{inspection point}
540 An @i{inspection point} is a point in the object code
541 corresponding to the occurrence of a pragma Inspection_@!Point in the
542 compilation unit.
543 @Defn{inspectable object}
544 An object is @i{inspectable} at an inspection point if the corresponding
545 pragma Inspection_Point either has an argument denoting that object,
546 or has no arguments@Chg{New=[ and the @Chg{Version=[2],New=[declaration
547 of the ],Old=[]}object is visible at the inspection point],Old=[]}.
548 @begin{ramification}
549 If a pragma Inspection_Point is in an in-lined subprogram, there
550 might be numerous inspection points in the object code corresponding to
551 the single occurrence of the pragma in the source; similar considerations
552 apply if such a pragma is in a generic, or in a loop that has
553 been @lquotes@;unrolled@rquotes@; by an optimizer.
554
555 @ChgRef{Version=[1],Kind=[Added],Ref=[8652/0093],ARef=[AI95-00207-01]}
556 @ChgAdded{Version=[1],Text=[The short form of the pragma is a convenient shorthand for
557 listing all objects which could be explicitly made inspectable by the long
558 form of the pragma; thus only visible objects are made inspectable by it.
559 Objects that are not visible at the point of the pragma are not made
560 inspectable by the short form pragma. This is necessary so that implementations
561 need not keep information about (or prevent optimizations on) a unit simply
562 because some other unit @i<might> contain a short form Inspection_Point
563 pragma.]}
564 @end{ramification}
565 @begin{Discussion}
566 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
567 If the short form of the pragma is used, then all@Chg{New=[ visible],Old=[]}
568 objects are inspectable.
569 This implies that @Chg{New=[global objects from other compilation units],
570 Old=[objects out of scope at the point of the pragma]} are inspectable. A good
571 interactive debugging system could provide information
572 similar to a post-mortem dump at such inspection points. The annex does
573 not require that any inspection facility is provided, merely that the
574 information is available to understand the state of the machine at those
575 points.
576 @end{Discussion}
577 @end{StaticSem}
578
579 @begin{RunTime}
580 Execution of a pragma Inspection_Point has no effect.
581 @begin{Discussion}
582
583 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
584 Although an inspection point has no (semantic) effect,
585 the removal or adding @Chg{Version=[2],New=[of ],Old=[]}a new point could
586 change the machine code generated by the compiler.
587
588 @end{Discussion}
589 @end{RunTime}
590
591 @begin{ImplReq}
592 Reaching an inspection point is an external interaction
593 with respect to the values
594 of the inspectable objects at that point
595 (see @RefSecNum{Conformity of an Implementation with the Standard}).
596 @begin{Ramification}
597 The compiler is inhibited from moving an assignment to
598 an inspectable variable past an inspection point for that variable.
599 On the other hand, the evaluation of an expression that might raise
600 an exception may be moved past an inspection point
601 (see @RefSecNum[Exceptions and Optimization]).@end{ramification}
602 @end{ImplReq}
603
604 @begin{DocReq}
605 For each inspection point,
606 the implementation shall
607 identify a mapping between each inspectable object and the machine resources
608 (such as memory locations or registers) from which the object's value
609 can be obtained.
610 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
611 Text=[@ChgDeleted{Version=[2],
612 Text=[Implementation-defined aspects of pragma Inspection_Point.]}]}
613 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
614 Text=[For each inspection point, a mapping between each inspectable object
615 and the machine resources where the object's value can be obtained shall
616 be provided.]}]}
617 @end{DocReq}
618
619 @begin{Notes}
620 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
621 The implementation is not allowed to perform @lquotes@;dead store elimination@rquotes@; on
622 the last assignment to a variable prior to a point where the
623 variable is inspectable.
624 Thus an inspection point has the effect of an
625 implicit @Chg{Version=[2],New=[read of],Old=[reference to]} each of its
626 inspectable objects.
627
628 Inspection points are useful in maintaining a correspondence between the
629 state of the program in source code terms, and the machine state during
630 the program's execution. Assertions about the values of program objects
631 can be tested in machine terms at inspection points. Object code between
632 inspection points can be processed by automated tools to
633 verify programs mechanically.
634 @begin{Discussion}
635
636 Although it is not a requirement of the annex, it would be useful if the
637 state of the stack and heap could be interrogated. This would allow users
638 to check that a program did not have a `storage leak'.
639
640 @end{Discussion}
641
642 The identification of the mapping from source program objects to machine
643 resources is allowed to be in the form of an
644 annotated object listing, in human-readable or tool-processable form.
645 @begin{Discussion}
646
647 In principle, it is easy to check an implementation for this pragma, since
648 one merely needs to check the content of objects against those values
649 known from the source listing. In practice, one needs a tool similar
650 to an interactive debugger to perform the check.
651
652 @end{Discussion}
653 @end{Notes}
654
655 @begin{DiffWord95}
656 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0093],ARef=[AI95-00207-01]}
657 @ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the definition of
658 the Inspection_Point pragma to apply to only variables visible at the point
659 of the pragma. Otherwise, the compiler would have to assume that some
660 other code somewhere could have a pragma Inspection_Point, preventing many
661 optimizations (such as unused object elimination).]}
662 @end{DiffWord95}
663
664
665 @LabeledRevisedClause{Version=[2],New=[High Integrity Restrictions],Old=[Safety and Security Restrictions]}
666 @begin{Intro}
667 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
668 This @Chg{Version=[3],New=[subclause],Old=[clause]} defines restrictions that can be used with pragma
669 Restrictions (see @RefSecNum(Pragma Restrictions and Pragma Profile)); these
670 facilitate the demonstration of program correctness by allowing
671 tailored versions of the run-time system.
672 @begin{Discussion}
673
674 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]}
675 Note that the restrictions are absolute. If a partition has 100 library
676 units and just one needs Unchecked_Conversion, then the pragma cannot be
677 used to ensure the other 99 units do not use Unchecked_Conversion. Note also
678 that these are restrictions on all Ada code within a partition, and
679 therefore it @Chg{Version=[3],New=[might],Old=[may]} not be evident
680 from the specification of a package whether a restriction can be imposed.
681
682 @end{Discussion}
683 @end{Intro}
684
685 @begin{StaticSem}
686 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00347-01],ARef=[AI95-00394-01]}
687 @ChgDeleted{Version=[2],Text=[The following restrictions,
688 the same as in @RefSecNum{Tasking Restrictions},
689 apply in this Annex:
690 No_Task_@!Hierarchy,
691 No_Abort_@!Statement,
692 No_Implicit_@!Heap_@!Allocation,
693 Max_@!Task_@!Entries is 0,
694 Max_@!Asynchronous_@!Select_@!Nesting is 0, and
695 Max_@!Tasks is 0.
696 @redundant[The last three restrictions are checked prior to program execution.]]}
697
698 @Trailing@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00394-01]}
699 The following @Chg{Version=[2],New=[@SynI{restriction_}@nt{identifier}s are
700 language defined:],Old=[additional restrictions apply in this Annex.]}
701
702 @leading@keepnext@b{Tasking-related restriction:}
703
704 @begin{Description}
705 @Trailing@;@Defn2{Term=[restrictions],Sec=(No_Protected_Types)}@Chg{Version=[3],New=[@Defn{No_Protected_Types restriction}],
706 Old=[]}No_Protected_Types @\There
707 are no declarations of protected types or protected objects.
708 @end{Description}
709
710 @leading@keepnext@b{Memory-management related restrictions:}
711
712 @begin{Description}
713 @Defn2{Term=[restrictions],Sec=(No_Allocators)}@Chg{Version=[3],New=[@Defn{No_Allocators restriction}],
714 Old=[]}No_Allocators @\There are no
715 occurrences of an @nt{allocator}.
716
717 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0042],ARef=[AI95-00130]}
718 @Defn2{Term=[restrictions],Sec=(No_Local_Allocators)}@Chg{Version=[3],New=[@Defn{No_Local_Allocators restriction}],
719 Old=[]}No_Local_Allocators @\@nt{Allocator}s
720 are prohibited in subprograms, generic subprograms,
721 tasks, and entry bodies@Chg{New=[],Old=[; instantiations of generic packages
722 are also prohibited in these contexts]}.
723 @begin[Ramification]
724 Thus @nt{allocator}s are permitted only in expressions whose
725 evaluation can only be performed before the main subprogram is invoked.
726 @end[Ramification]
727 @begin[Reason]
728 @ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0042],ARef=[AI95-00130]}
729 @ChgNote{The associated rule has been deleted.}
730 @ChgDeleted{Version=[1],Text=[The reason for the prohibition against
731 instantiations of
732 generic packages is to avoid contract model violations.
733 An alternative would be to prohibit @nt{allocator}s from generic
734 packages, but it seems preferable to allow generality on the
735 defining side and then place the restrictions on the usage (instantiation),
736 rather than inhibiting what can be in the generic while
737 liberalizing where they can be instantiated.]}
738 @end[Reason]
739
740 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0152-1],ARef=[AI05-0262-1]}
741 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],Sec=(No_Anonymous_Allocators)}@Defn{No_Anonymous_Allocators restriction}
742 No_Anonymous_Allocators @\There are no @nt{allocator}s of anonymous access types.]}
743
744 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0190-1]}
745 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],Sec=(No_Coextensions)}@Defn{No_Coextensions restriction}
746 No_Coextensions @\There are no coextensions. See @RefSecNum{Operations of Access Types}.]}
747
748 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0190-1]}
749 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],
750 Sec=(No_Access_Parameter_Allocators)}@Defn{No_Access_Parameter_Allocators restriction}
751 No_Access_Parameter_Allocators @\@nt{Allocator}s
752 are not permitted as the actual parameter to an access parameter.
753 See @RefSecNum{Subprogram Declarations}.]}
754
755 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
756 @Comment{We can't reuse this paragraph for the above, because there is no
757 way to have the hanging marker in both the added and deleted text (and since it
758 isn't in Ada 2005 at all).}
759 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[restrictions],
760 Sec=(No_Unchecked_Deallocation)}No_Unchecked_Deallocation @\Semantic
761 dependence on Unchecked_Deallocation is not allowed.]}
762 @begin{Discussion}
763 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
764 @ChgDeleted{Version=[2],Text=[This restriction would be useful in those
765 contexts in which heap storage is needed on program start-up, but need not be
766 increased subsequently. The danger of a dangling pointer can therefore be
767 avoided.]}
768 @end{Discussion}
769
770 @Trailing@;Immediate_Reclamation @\Except for storage occupied by objects created by
771 @nt{allocator}s and not deallocated via unchecked deallocation, any storage
772 reserved at run time for an object is immediately reclaimed when the
773 object no longer exists.
774 @Defn2{Term=[restrictions],Sec=(Immediate_Reclamation)}@Chg{Version=[3],New=[@Defn{Immediate_Reclamation restriction}],
775 Old=[]}
776 @begin{Discussion}
777 Immediate reclamation would apply to storage created by the compiler, such
778 as for a return value from a function whose size is not known at the
779 call site.
780 @end{Discussion}
781 @end{Description}
782
783 @leading@keepnext@b{Exception-related restriction:}
784
785 @begin{Description}
786 @Trailing@Defn2{Term=[restrictions],Sec=(No_Exceptions)}@Chg{Version=[3],New=[@Defn{No_Exceptions restriction}],
787 Old=[]}No_Exceptions @\@nt{Raise_statement}s
788 and @nt{exception_handler}s are not allowed.
789 No language-defined run-time checks are generated;
790 however, a run-time check performed automatically by the hardware
791 is permitted.
792 @begin{Discussion}
793
794 This restriction mirrors a method of working that is quite common in the
795 safety area. The programmer is required to show that exceptions cannot be
796 raised. Then a simplified run-time system is used without exception
797 handling. However, some hardware checks may still be enforced. If the
798 software check would have failed, or if the hardware check actually fails,
799 then the execution of the program is unpredictable.
800 There are obvious dangers in this approach, but it is similar to
801 programming at the assembler level.
802
803 @end{Discussion}
804 @end{Description}
805
806 @leading@keepnext@b{Other restrictions:}
807
808 @begin{Description}
809 @Defn2{Term=[restrictions],Sec=(No_Floating_Point)}@Chg{Version=[3],New=[@Defn{No_Floating_Point restriction}],
810 Old=[]}No_Floating_Point @\Uses of predefined floating point types and
811 operations, and declarations of new floating point types, are
812 not allowed.
813 @begin{Discussion}
814
815 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
816 The intention is to avoid the use of floating point hardware at run time,
817 but this is expressed in
818 language terms. It is conceivable that floating point is used implicitly in
819 some contexts, say fixed point type conversions of high accuracy. However,
820 the @ImplReqTitle below make it clear that the restriction would apply
821 to the @lquotes@;run-time system@rquotes@; and hence not be allowed.
822 This @Chg{Version=[2],New=[restriction],Old=[parameter]} could be used to
823 inform a compiler that a variant of the architecture is being used which does
824 not have floating point instructions.
825
826 @end{Discussion}
827
828 @Defn2{Term=[restrictions],Sec=(No_Fixed_Point)}@Chg{Version=[3],New=[@Defn{No_Fixed_Point restriction}],
829 Old=[]}No_Fixed_Point @\Uses of predefined fixed point types and
830 operations, and declarations of new fixed point types, are
831 not allowed.
832 @begin{Discussion}
833
834 This restriction would have the side effect of prohibiting the
835 @nt{delay_relative_statement}.
836 As with the No_Floating_Point restriction, this might be used to
837 avoid any question of rounding errors. Unless an Ada run-time is written in
838 Ada, it seems hard to rule out implicit use of fixed point, since at the
839 machine level, fixed point is virtually the same as integer arithmetic.
840
841 @end{Discussion}
842
843 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
844 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[restrictions],
845 Sec=(No_Unchecked_Conversion)}No_Unchecked_Conversion @\Semantic dependence
846 on the predefined generic Unchecked_Conversion is not allowed.]}
847 @begin{Discussion}
848 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
849 @ChgDeleted{Version=[2],Text=[Most critical applications would require
850 some restrictions or additional validation checks on uses of unchecked
851 conversion. If the application does not require the functionality, then
852 this restriction provides a means of ensuring the design requirement has
853 been satisfied. The same applies to several of the following restrictions.]}
854 @end{Discussion}
855
856 No_Access_Subprograms @\The declaration of access-to-subprogram types
857 is not allowed.
858 @Defn2{Term=[restrictions],Sec=(No_Access_Subprograms)}@Chg{Version=[3],New=[@Defn{No_Access_Subprograms restriction}],
859 Old=[]}
860 @begin{Discussion}@ChgNote{Moved from above}
861 @ChgRef{Version=[2],Kind=[Added]}
862 @ChgAdded{Version=[2],Text=[Most critical applications would require
863 some restrictions or additional validation checks on uses of
864 access-to-subprogram types. If the application does not require the
865 functionality, then this restriction provides a means of ensuring the design
866 requirement has been satisfied. The same applies to several of the following
867 restrictions, and to restriction No_Dependence => Ada.Unchecked_Conversion.]}
868 @end{Discussion}
869
870 @Defn2{Term=[restrictions],Sec=(No_Unchecked_Access)}@Chg{Version=[3],New=[@Defn{No_Unchecked_Access restriction}],
871 Old=[]}No_Unchecked_Access @\The @attr[Unchecked_Access] attribute
872 is not allowed.
873
874 @Defn2{Term=[restrictions],Sec=(No_Dispatch)}@Chg{Version=[3],New=[@Defn{No_Dispatch restriction}],
875 Old=[]}No_Dispatch @\Occurrences of T'Class are not allowed, for any
876 (tagged)
877 subtype T.
878
879 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
880 @Defn2{Term=[restrictions],Sec=(No_IO)}@Chg{Version=[3],New=[@Defn{No_IO restriction}],
881 Old=[]}No_IO @\Semantic dependence on
882 any of the library units
883 Sequential_IO, Direct_IO, Text_IO, Wide_Text_IO, @Chg{Version=[2],
884 New=[Wide_Wide_Text_IO, ],Old=[]}or Stream_IO is not allowed.
885 @begin{Discussion}
886
887 Excluding the input-output facilities of an implementation may be needed
888 in those environments which cannot support the supplied functionality.
889 A program in such an environment is likely to require some low level
890 facilities or a call on a non-Ada feature.
891
892 @end{Discussion}
893
894 @Defn2{Term=[restrictions],Sec=(No_Delay)}@Chg{Version=[3],New=[@Defn{No_Delay restriction}],
895 Old=[]}No_Delay @\@nt[Delay_Statement]s
896 and semantic dependence on package Calendar
897 are not allowed.
898 @begin[Ramification]
899 This implies that @nt[delay_alternative]s in a
900 @nt[select_statement] are prohibited.
901
902 The purpose of this restriction is to avoid the need for timing facilities
903 within the run-time system.
904
905 @end[ramification]
906
907 @Defn2{Term=[restrictions],Sec=(No_Recursion)}@Chg{Version=[3],New=[@Defn{No_Recursion restriction}],
908 Old=[]}No_Recursion @\As part of the execution of a subprogram, the same
909 subprogram is not invoked.
910
911 @Defn2{Term=[restrictions],Sec=(No_Reentrancy)}@Chg{Version=[3],New=[@Defn{No_Reentrancy restriction}],
912 Old=[]}No_Reentrancy @\During the execution of a subprogram by a task, no other
913 task invokes the same subprogram.
914
915 @end{description}
916 @end{StaticSem}
917
918 @begin{ImplReq}
919
920 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00394-01]}
921 @ChgAdded{Version=[2],Type=[Leading],Text=[An implementation of this Annex
922 shall support:]}
923 @begin{Itemize}
924 @ChgRef{Version=[2],Kind=[Added]}
925 @ChgAdded{Version=[2],Text=[the restrictions defined in this subclause; and]}
926
927 @ChgRef{Version=[2],Kind=[Added]}
928 @ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0189-1]}
929 @ChgAdded{Version=[2],Text=[the following restrictions defined in
930 @RefSecNum{Tasking Restrictions}: No_Task_Hierarchy,
931 No_Abort_Statement, No_Implicit_Heap_Allocation@Chg{Version=[3],New=[,
932 No_Standard_Allocators_After_Elaboration], Old=[]}; and]}
933
934 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00347-01]}
935 @ChgAdded{Version=[2],Text=[the @key{pragma} Profile(Ravenscar); and]}
936 @begin{Discussion}
937 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
938 @ChgAdded{Version=[2],Text=[The reference to pragma Profile(Ravenscar) is
939 intended to show that properly restricted tasking is appropriate for use
940 in high integrity systems. The Ada 95
941 Annex seemed to suggest that tasking was inappropriate for such systems.]}
942 @end{Discussion}
943
944 @ChgRef{Version=[2],Kind=[Added]}
945 @ChgAdded{Version=[2],Type=[Leading],Text=[the following uses of
946 @SynI{restriction_parameter_}@nt{identifier}s defined in
947 @RefSecNum{Tasking Restrictions}@Redundant[, which are checked
948 prior to program execution]:]}
949 @begin{InnerItemize}
950 @ChgRef{Version=[2],Kind=[Added]}
951 @ChgAdded{Version=[2],Text=[Max_Task_Entries => 0,]}
952
953 @ChgRef{Version=[2],Kind=[Added]}
954 @ChgAdded{Version=[2],Text=[Max_Asynchronous_Select_Nesting => 0, and]}
955
956 @ChgRef{Version=[2],Kind=[Added]}
957 @ChgAdded{Version=[2],Text=[Max_Tasks => 0.]}
958 @end{InnerItemize}
959 @end{Itemize}
960
961 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0263-1],ARef=[AI05-0272-1]}
962 If an implementation supports @nt[pragma] Restrictions for a particular
963 argument, then except for the restrictions No_Unchecked_Deallocation,
964 No_Unchecked_Conversion, No_Access_Subprograms,
965 @Chg{Version=[3],New=[],Old=[and ]}No_Unchecked_Access,
966 @Chg{Version=[3],New=[No_Specification_of_Aspect, No_Use_of_Attribute,
967 No_Use_of_Pragma, and the equivalent use of No_Dependence, ],Old=[]}the
968 associated restriction applies to the run-time system.
969 @begin[reason]
970 Permission is granted for the run-time system to use the specified
971 otherwise-restricted features, since the use of these features may
972 simplify the run-time system by allowing more of it to be written
973 in Ada.
974 @end[reason]
975 @begin{Discussion}
976
977 The restrictions that are applied to the partition are also applied to the
978 run-time system. For example, if No_Floating_Point is specified,
979 then an implementation that uses floating point for implementing the delay
980 statement (say) would require that No_Floating_Point is
981 only used in conjunction with No_Delay. It is clearly important that
982 restrictions are effective so that Max_Tasks=0 does imply that tasking is
983 not used, even implicitly (for input-output, say).
984
985 An implementation of tasking could be produced based upon a run-time
986 system written in Ada in which the rendezvous was controlled by
987 protected types. In this case, No_Protected_Types could only be used in
988 conjunction with Max_Task_Entries=0. Other implementation dependencies
989 could be envisaged.
990
991 If the run-time system is not written in Ada, then the wording needs to be
992 applied in an appropriate fashion.
993
994 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0263-1]}
995 @ChgAdded{Version=[3],Text=["the equivalent use of No_Dependence" refers
996 to @exam{No_Dependence => Ada.Unchecked_Conversion} and the like, not all
997 uses of No_Dependence.]}
998
999 @end{Discussion}
1000 @end{ImplReq}
1001
1002 @begin{DocReq}
1003 If a pragma Restrictions(No_Exceptions) is specified, the implementation
1004 shall document the effects of all constructs where language-defined checks are
1005 still performed automatically (for example, an overflow check performed
1006 by the processor).
1007 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
1008 Text=[@ChgDeleted{Version=[2],
1009 Text=[Implementation-defined aspects of pragma Restrictions.]}]}
1010 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
1011 If a pragma Restrictions(No_Exceptions) is specified, the effects of all
1012 constructs where language-defined checks are still performed.]}]}
1013 @begin{Discussion}
1014
1015 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
1016 The documentation requirements here are quite difficult to satisfy. One
1017 method is to review the object code generated and determine the checks that
1018 are still present, either explicitly, or implicitly within the architecture.
1019 As another example from that of overflow, consider the question of
1020 @Chg{Version=[2],New=[dereferencing],Old=[deferencing]} a null pointer.
1021 This could be undertaken by a memory access trap
1022 when checks are performed. When checks are suppressed via the argument
1023 No_Exceptions, it would not be necessary to have the memory access trap
1024 mechanism enabled.
1025
1026 @end{Discussion}
1027 @end{DocReq}
1028
1029 @begin{Erron}
1030 @PDefn2{Term=(erroneous execution),Sec=(cause)}
1031 Program execution is erroneous if pragma Restrictions(No_Exceptions)
1032 has been specified and the conditions arise under which a generated
1033 language-defined run-time check would fail.
1034 @begin{Discussion}
1035
1036 The situation here is very similar to the application of pragma Suppress.
1037 Since users are removing some of the protection the language
1038 provides, they had better be careful!
1039
1040 @end{Discussion}
1041
1042 @PDefn2{Term=(erroneous execution),Sec=(cause)}
1043 Program execution is erroneous if pragma Restrictions(No_Recursion)
1044 has been specified and a subprogram is invoked as part of its
1045 own execution,
1046 or if pragma Restrictions(No_Reentrancy) has been specified and
1047 during the execution of a subprogram by a task, another task invokes
1048 the same subprogram.
1049 @begin{Discussion}
1050
1051 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]}
1052 In practice, many implementations @Chg{Version=[3],New=[might],Old=[may]}
1053 not exploit the absence of recursion
1054 or need for reentrancy, in which case the program execution would be
1055 unaffected by the use of recursion or reentrancy, even though the program is
1056 still formally erroneous.
1057
1058 @end{Discussion}
1059 @end{Erron}
1060
1061 @ChgNote{I can't find any reason in the normative wording for this item;
1062 therefore I've removed it. The notes below (commented out anyway) refer only
1063 to a nonstandard mode, which is irrelevant in the Standard.}
1064 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
1065 Text=[@ChgDeleted{Version=[2],
1066 Text=[Any restrictions on pragma Restrictions.]}]}
1067
1068 @begin{Notes}
1069 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1070 @ChgAdded{Version=[2],Text=[Uses of @Syni{restriction_parameter_}@nt{identifier}
1071 No_Dependence defined in @RefSecNum{Language-Defined Restrictions and Profiles}:
1072 No_Dependence => Ada.@!Unchecked_@!Deallocation and No_Dependence =>
1073 Ada.@!Unchecked_@!Conversion may be appropriate for high-integrity systems.
1074 Other uses of No_Dependence can also be appropriate for high-integrity
1075 systems.]}
1076 @begin{Discussion}
1077 @ChgRef{Version=[2],Kind=[AddedNormal]}
1078 @ChgAdded{Version=[2],Text=[The specific mention of these two uses
1079 is meant to replace the identifiers now banished to
1080 @RefSec{Dependence Restriction Identifiers}.]}
1081
1082 @ChgRef{Version=[2],Kind=[AddedNormal]}
1083 @ChgAdded{Version=[2],Text=[Restriction No_Dependence => Ada.Unchecked_Deallocation
1084 would be useful in those
1085 contexts in which heap storage is needed on program start-up, but need not be
1086 increased subsequently. The danger of a dangling pointer can therefore be
1087 avoided.]}@ChgNote{Moved down from above.}
1088 @end{Discussion}
1089
1090 @end{Notes}
1091
1092 @begin{comment}
1093 @begin{Notes}
1094 The standard mode for pragma Restrictions is that a
1095 compilation unit
1096 (or a partition if at link time) is illegal
1097 if it makes use of a feature identified in the pragma.
1098 However, an implementation is allowed to have a mode of operation
1099 where it issues a warning message versus rejecting the unit or partition,
1100 and where the run-time system supplied for the partition
1101 includes support for the identified feature.
1102
1103 An implementation need not independently support the restrictions
1104 identified above, but may instead require that if a particular
1105 restriction is identified in a @nt(pragma) Restrictions, then
1106 other restrictions (the exact set of which is implementation defined)
1107 need also to be identified.
1108
1109 In such a case, if the additional
1110 restrictions are not specified in a @nt(pragma) Restrictions, and
1111 a unit or partition uses such a feature, the implementation should
1112 @begin{itemize}
1113 issue a warning that the pragma is being ignored (that is, the
1114 full RTS is being used),
1115
1116 identify to the user the additional restrictions that need to be
1117 specified in the pragma in order to obtain the reduced RTS, and
1118 identify any constructs that would use any of the features so
1119 proscribed
1120 @end{itemize}
1121 @end{Notes}
1122 @end{comment}
1123
1124 @begin{Extend95}
1125 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0042],ARef=[AI95-00130-01]}
1126 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1127 No_Local_Allocators no longer prohibits generic instantiations.]}
1128 @end{Extend95}
1129
1130 @begin{DiffWord95}
1131 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
1132 @ChgAdded{Version=[2],Text=[Wide_Wide_Text_IO (which is new) is added to the
1133 No_IO restriction.]}
1134
1135 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
1136 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
1137 @ChgAdded{Version=[2],Text=[The title of this @Chg{Version=[3],New=[subclause],Old=[clause]} was changed to match the
1138 change to the Annex title. Pragma Profile(Ravenscar) is part of this annex.]}
1139
1140 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1141 @ChgAdded{Version=[2],Text=[Restriction No_Dependence is used instead of
1142 special @i<restriction_>@nt<identifier>s. The old names are banished to
1143 Obsolescent Features (see @RefSecNum{Dependence Restriction Identifiers}).]}
1144
1145 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1146 @ChgAdded{Version=[2],Text=[The bizarre wording @lquotes@;apply in this
1147 Annex@rquotes (which no one quite can explain the meaning of) is banished.]}
1148 @end{DiffWord95}
1149
1150 @begin{Extend2005}
1151 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0152-1],ARef=[AI05-0190-1]}
1152 @ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 95}Restrictions
1153 No_Anonymous_Allocators, No_Coextensions, and No_Access_Parameter_Allocators
1154 are new.]}
1155 @end{Extend2005}
1156
1157 @begin{DiffWord2005}
1158 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0189-1]}
1159 @ChgAdded{Version=[3],Text=[New restriction
1160 No_Standard_Allocators_After_Elaboration is added to the list of
1161 restrictions that are required by this annex.]}
1162
1163 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0263-1]}
1164 @ChgAdded{Version=[3],Text=[@b<Correction:> Ada 2005 restriction No_Dependence
1165 is added where needed (this was missed in Ada 2005).]}
1166
1167 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0272-1]}
1168 @ChgAdded{Version=[3],Text=[Restrictions against individual aspects, pragmas,
1169 and attributes do not apply to the run-time system, in order that an
1170 implementation can use whatever aspects, pragmas, and attributes are needed
1171 to do the job. For instance, attempting to write a run-time system for Linux
1172 that does not use the Import aspect would be very difficult and probably is
1173 not what the user is trying to prevent anyway.]}
1174 @end{DiffWord2005}
1175
1176
1177 @LabeledAddedClause{Version=[2],Name=[Pragma Detect_Blocking]}
1178
1179 @begin{Intro}
1180 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1181 @ChgAdded{Version=[2],Text=[The following @nt{pragma} forces an implementation
1182 to detect potentially blocking operations within a protected operation.]}
1183 @end{Intro}
1184
1185 @begin{Syntax}
1186 @begin{SyntaxText}
1187 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1188 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1189 @nt{pragma} Detect_Blocking is as follows:]}
1190 @end{SyntaxText}
1191 @ChgRef{Version=[2],Kind=[AddedNormal]}
1192 @AddedPragmaSyn<Version=[2],@ChgAdded{Version=[2],
1193 Text=[@key{pragma} @prag<Detect_Blocking>;]}>
1194 @end{Syntax}
1195
1196 @begin{LinkTime}
1197 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1198 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Detect_Blocking)}
1199 @PDefn2{Term=[pragma, configuration], Sec=(Detect_Blocking)}
1200 A @nt{pragma} Detect_Blocking is a configuration
1201 pragma.]}
1202 @end{LinkTime}
1203
1204 @begin{RunTime}
1205 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1206 @ChgAdded{Version=[2],Text=[An implementation is required to detect a
1207 potentially blocking operation within a protected operation, and to raise
1208 Program_Error (see @RefSecNum{Protected Subprograms and Protected Actions}).]}
1209 @end{RunTime}
1210
1211 @begin{ImplPerm}
1212 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1213 @ChgAdded{Version=[2],Text=[An implementation is allowed to reject a
1214 @nt{compilation_unit} if a potentially blocking operation is present directly
1215 within an @nt{entry_body} or the body of a protected subprogram.]}
1216 @end{ImplPerm}
1217
1218 @begin{Notes}
1219 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1220 @ChgAdded{Version=[2],Text=[An operation that causes a task to be blocked
1221 within a foreign language domain is not defined to be potentially blocking,
1222 and need not be detected.]}
1223 @end{Notes}
1224
1225 @begin{Extend95}
1226 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1227 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1228 Pragma Detect_Blocking is new.]}
1229 @end{Extend95}
1230
1231 @RMNewPageVer{Version=[2]}@Comment{For printed version of Ada 2005 RM}
1232 @LabeledAddedClause{Version=[2],Name=[Pragma Partition_Elaboration_Policy]}
1233
1234 @begin{Intro}
1235 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1236 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
1237 @ChgAdded{Version=[2],Text=[This @Chg{Version=[3],New=[subclause],Old=[clause]}
1238 defines a @nt{pragma} for user control over elaboration policy.]}
1239 @end{Intro}
1240
1241 @begin{Syntax}
1242 @begin{SyntaxText}
1243 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1244 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1245 @nt{pragma} Partition_Elaboration_Policy is as follows:]}
1246 @end{SyntaxText}
1247 @ChgRef{Version=[2],Kind=[AddedNormal]}
1248 @AddedPragmaSyn<Version=[2],@ChgAdded{Version=[2],
1249 Text=[@key{pragma} @prag<Partition_Elaboration_Policy> (@SynI<policy_>@Syn2<identifier>);]}>
1250
1251 @begin{SyntaxText}
1252 @ChgRef{Version=[2],Kind=[AddedNormal]}
1253 @ChgAdded{Version=[2],Text=[The @SynI<policy_>@nt{identifier} shall be either
1254 Sequential, Concurrent or an implementation-defined identifier.]}
1255 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[Implementation-defined
1256 @SynI<policy_>@nt<identifier>s allowed in a @nt{pragma} Partition_Elaboration_Policy.],Old=[]}]}
1257
1258 @begin{Ramification}
1259 @ChgRef{Version=[3],Kind=[AddedNormal]}
1260 @ChgAdded{Version=[3],Text=[Note that the Ravenscar profile (see
1261 @RefSecNum{The Ravenscar Profile}) has nothing to say about which
1262 Partition_Elaboration_Policy is used. This was intentionally omitted from the
1263 profile, as there was no agreement as to whether the Sequential policy should
1264 be required for Ravenscar programs. As such it was defined separately.]}
1265 @end{Ramification}
1266 @end{SyntaxText}
1267 @end{Syntax}
1268
1269 @begin{LinkTime}
1270 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1271 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Partition_Elaboration_Policy)}
1272 @PDefn2{Term=[pragma, configuration], Sec=(Partition_Elaboration_Policy)}
1273 A @nt{pragma} Partition_Elaboration_Policy is a configuration pragma.
1274 It specifies the elaboration policy for a partition.
1275 At most one elaboration policy shall be specified for a partition.]}
1276
1277 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1278 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1279 @ChgAdded{Version=[2],Text=[If the Sequential policy is
1280 specified for a partition@Chg{Version=[3],New=[,],Old=[]} then pragma
1281 Restrictions (No_Task_Hierarchy) shall also be specified for the partition.]}
1282 @end{LinkTime}
1283
1284 @begin{RunTime}
1285 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1286 @ChgAdded{Version=[2],Text=[Notwithstanding@Defn{notwithstanding} what this
1287 International Standard
1288 says elsewhere, this @nt{pragma} allows partition elaboration rules concerning
1289 task activation and interrupt attachment to be changed. If the
1290 @SynI{policy_}@nt{identifier} is Concurrent, or if there is no pragma
1291 Partition_Elaboration_Policy defined for the partition, then the rules defined
1292 elsewhere in this Standard apply.]}
1293
1294 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1295 @ChgAdded{Version=[2],Type=[Leading],Text=[If the partition elaboration policy
1296 is Sequential, then task activation and interrupt attachment are performed in
1297 the following sequence of steps:]}
1298
1299 @begin{Itemize}
1300 @ChgRef{Version=[2],Kind=[AddedNormal]}
1301 @ChgAdded{Version=[2],Text=[The activation of all library-level tasks and the
1302 attachment of interrupt handlers are deferred until all library units are
1303 elaborated.]}
1304
1305 @ChgRef{Version=[2],Kind=[AddedNormal]}
1306 @ChgAdded{Version=[2],Text=[The interrupt handlers are attached by the
1307 environment task.]}
1308
1309 @ChgRef{Version=[2],Kind=[AddedNormal]}
1310 @ChgAdded{Version=[2],Text=[The environment task is suspended while the
1311 library-level tasks are activated.]}
1312
1313 @ChgRef{Version=[2],Kind=[AddedNormal]}
1314 @ChgAdded{Version=[2],Text=[The environment task executes the main subprogram
1315 (if any) concurrently with these executing tasks.]}
1316 @end{Itemize}
1317
1318 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1319 @ChgAdded{Version=[2],Text=[If several dynamic interrupt handler attachments for
1320 the same interrupt are deferred, then the most recent call of
1321 Attach_Handler or Exchange_Handler determines which handler is attached.]}
1322
1323 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1324 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, Tasking_Error
1325 is raised at the beginning of the sequence of statements of the
1326 body of the environment task prior to calling the
1327 main subprogram.]}
1328
1329 @end{RunTime}
1330
1331 @begin{ImplAdvice}
1332 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1333 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1334 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1335 and the Environment task becomes permanently blocked during
1336 elaboration@Chg{Version=[3],New=[,],Old=[]} then the partition is deadlocked and
1337 it is recommended that the partition be immediately terminated.]}
1338 @ChgImplAdvice{Version=[3],Kind=[Revised],InitialVersion=[2],
1339 Text=[@ChgAdded{Version=[2],
1340 Text=[If the partition elaboration policy is Sequential
1341 and the Environment task becomes permanently blocked during
1342 elaboration@Chg{Version=[3],New=[,],Old=[]} then
1343 the partition should be immediately terminated.]}]}
1344
1345 @end{ImplAdvice}
1346
1347 @begin{ImplPerm}
1348 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1349 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1350 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1351 and any task activation fails@Chg{Version=[3],New=[,],Old=[]} then an
1352 implementation may immediately terminate the active partition to mitigate the
1353 hazard posed by continuing to execute with a subset of the tasks being active.]}
1354 @end{ImplPerm}
1355
1356 @begin{Notes}
1357 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00421-01]}
1358 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, the
1359 environment task is unable to handle the Tasking_Error exception and completes
1360 immediately. By contrast, if the partition elaboration policy is Concurrent,
1361 then this exception could be handled within a library unit.]}
1362 @end{Notes}
1363
1364
1365 @begin{Extend95}
1366 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1367 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1368 @nt{Pragma} Partition_Elaboration_Policy is new.]}
1369 @end{Extend95}
1370
1371
1372
1373