Article - CS253748

Different elaboration when using a variable or a constant in an address clause

Modified: 03-Jan-2017   


Applies To

  • ApexAda 4.4 to 5.0
  • For example, if an object used to specify or compute the address is declared as a variable and assigned a numeric literal, like one of these:
    • A1 : Interfaces.Unsigned_32 := 16#80000000#;
    • A_static : constant := 16#80000000#;
A2 : Interfaces.Unsigned_32 := a_static;
the generated elaboration code may be a combination of byte, halfword, and word store instructions. The exact elaboration code depends on the structure of the record and its components.
  • Changing the declaration to a constant, like one of these:
    • A3 : constant Interfaces.Unsigned_32 := 16#80000000#;
    • A4 : constant := 16#80000000#;
    • A_static : constant := 16#80000000#;
A5 : constant Interfaces.Unsigned_32 := a_static;
may generate a series of halfword store instructions for the same record type.
 

Description

  • When declaring an address clause for a record type in ApexAda, different elaboration code may be generated if the address is specified or computed with a variable, rather than a constant.
  • This can cause elaboration or runtime problems, for example if the address clause is used to read or write memory mapped hardware, or a memory device that doesn’t allow byte addressing.
This is a printer-friendly version of Article 253748 and may be out of date. For the latest version click CS253748