- Ada 2012
- Ada 2005 / 95 / 83
- Embedded Development
- Formal Methods
- Open Source
- Safety-Critical Development
- Static Analysis
Dec 31st, 2004
New warning for misaligned objects
The existing warning about objects whose address was incompatible with the explicit alignment constraints has been extended. It now also warns when an object address is incompatible with explicit or implicit alignment constraints on its base type. The run time check is unchanged and Program_Error will still be raised when objects are not correctly aligned.
AI-381 Restriction No_Dependence
This new restriction allows the specification of arbitrary packages to be excluded from the semantic dependencies of a partition. This new restriction form (No_Dependence => unit) is allowed in both the standard Restrictions pragma, and in the GNAT pragma Restriction_Warnings. Note that, contrary to the current writeup (rev 1.7) of the AI, we have implemented the so-called syntactic approach which does not restrict the named package to be one of the language predefined ones. This is still under discussion in the ARG, and we anticipate that this approach will be the preferred one.
AI-377 Naming of generic child packages
This AI addresses a pathological visibility issue involving the implicit declaration of a generic child unit that is present within an instantiation of its parent. Specifically, a context clause has to be rejected when an instance I1 of a generic unit G1 has an explicit child unit I1.G2, G1 has a generic child also named G2, and the context includes with_clauses for both I1.G2 and for G1.G2, making the implicit declaration of the generic child unit I1.G2 visible as well.
AI-332 Resolution of qualified expressions
This AI clarifies the resolution rules for qualified expressions, object renaming, and other constructs, for which the term "expected type" is not used. GNAT implements properly the intent of this AI.
AI-331 Instantiation of generic child units
This AI clarifies the intent of RM 10.1.1(19) that generic child unit can be instantiated at any level of nesting (the original wording left this unclear). GNAT has always implemented this properly.
AI-268 Rounding of real static expressions
A literal reading of the wording of the Ada 95 standard appears to require that static float values exactly half way between two machine numbers are to be rounded in biased manner (away from zero), and hence treated differently from non-static environments where typical IEEE compatible systems do non-biased rounding. This is corrected in Ada 2005, where the rounding is implementation defined, with a recommendation to round the same way at compile time as at execution time. In fact GNAT Pro already follows this recommendation, even in Ada 95 mode, since it seems a clearly preferable approach.
AI-388 Add Greek Pi to Ada.Numerics
Ada.Numerics now contains an additional declaration using the greek letter pi as the identifier, with the same value as the previously available definition under the identifier Pi (which is retained). In Ada 2005 mode, wide characters can always appear in identifiers.
AI-364 Fixed-point multiply and divide operations
In Ada 2005, a special name resolution rule applies to user-defined multiplication and division operators on fixed-point types. If fixed-point type has such primitive operation, the predefined operator of the same name is not available. This rule fixes an incompatibility between Ada 83 and Ada 95, and makes the user-defined operators easier to use.
AI-242 Surprising behavior of Update
The Update procedure in Interfaces.C.Strings that takes a string parameter had the unexpected and unintended effect of truncating the result just past the inserted string. This was definitely not intended, and this AI documents the appropriate fix. In GNAT, we have fixed this in both Ada 95 and Ada 2005 mode, since it seems like a clear error.
Dec 26th, 2004
Better error msgs in pragma config file
The error messages for bad pragmas in configuration files have been improved in three respects: multiple errors are now posted if there are multiple bad pragmas, the error flags are posted more accurately, and the error message disinguishes the cases of unrecognized pragmas and the use of a non-configuration pragma.
AI-340 New attribute Mod
This AI introduces a new attribute Mod, available for any modular type, with one argument, which can be of any integer type. The result is this integer value mod the modulus of the modular type. This attribute is available only in Ada 2005 mode (-gnat05 switch). That's because mod is a reserved word, and it requires a change in the syntax to allow a new reserved word as an attribute identifier.
AI-283 Stream files truncated by close/reset
This AI specifies that Close and Reset on a stream file should not truncate the file. In practice, although strictly required by the Ada 95 RM, this was an obvious mistake, and GNAT has always done the right thing here (which is not to truncate the file).
Dec 23rd, 2004
Add unit kind to gnatmetric XML output
A new attribute describing the program unit kind is added to the 'unit' tag in the XML output generated by gnatmetric.
AI-196 Assignment and tag-indeterminate calls
For the assignment of the result of a tag-indeterminate dispatching call to a target of a class-wide type, the controlling tag value for the call is now defined by the tag of the target.
AI-368 New restriction No_Obsolescent_Features
This AI introduces a new restriction No_Obsolescent_Features, with the expected semantics of restricting use of Annex J features. The identifier can be used in pragma Restrictions or Restriction_Warnings. Note that the related warning -gnatwj is retained, since it is not quite the same, in that it also warns on use of obsolete GNAT features.
AI-316 Accessibility checks and value conversions
This AI is classified as a ramification and clarifies that the rule of 6.5(18) applies to any type conversion (including a value conversion) that can be used as the return expression for a return-by-reference type. This rule was already followed correctly by GNAT.
AI-369 Generic formal objects static in instance
This AI specifies that the name of a formal object of mode in associated with a static actual denotes a static constant in the instance. This rules has always been followed by GNAT.
AI-384 Conversion rule for access subtypes
This AI provides a symmetric legality rule for conversions of access subtypes. The conversion is now legal when either designated type is unconstrained, at the expense of a possible constraint check.
AI-258 Behavior of To_C for null string
This AI deals with the anomolous case of a call made to Interfaces.C.To_C with a null string and Append_Nul false. This routine is supposed to return a string with a lower bound of zero, but that is impossible in this case, since the index type is unsigned. The resolution is that this should raise Constraint_Error. Previously GNAT returned a string with bounds 1..0, but that clearly violated the required lower bound of zero.
AI-255 Renaming of subcomponent of generic in out
This AI confirms that the rule against renaming of components that depend on a discriminant applies to an in out generic parameter, even when its subtype is constrained.
AI-167 Validity check after unchecked conversion
This AI ensures that it is not erroneous to do an unchecked conversion producing an invalid value, followed by a 'Valid check on the result. In fact it has always been the case that GNAT guarantees this to work (the 'Valid check would not be much use otherwise!)
AI-200 Generic formal subprograms and dispatching
This AI revises the definition of primitive operations to make it clear that subprograms in a generic unit that override the primitive subprograms of a formal tagged type are not primitives of the formal type (or the actual type in an instantiation), and hence are not dispatching operations. This applies both to formal subprograms and subprograms occuring later in the generic specification. GNAT already implemented this intent correctly, so there will be no effect on users from this change to the revised rule (RM95-3.2.3(7)).
AI-214 Distinct names for subunits/child units
This AI allows compilers to reject an attempt to put child unit and subunit with the same expanded name into a compilation environment. In fact GNAT does permit this (via the parameter Subunit_File_Name of the Source_File_Name configuration pragma), but otherwise does reject it if this is not used.
Dec 6th, 2004
Windows uses Zero Cost Exceptions
GNAT for Windows now uses the zero cost exception mechanism by default. This speeds up most applications built with this new default runtime. The previous runtime, known as SJLJ (SetJump/LongJump) runtime, is provided as a second runtime.