Commit 76fd9416 by Pat Rogers Committed by Pierre-Marie de Rodat

[Ada] Correct size in representation clauses documentation

2019-07-01  Pat Rogers  <rogers@adacore.com>

gcc/ada/

	* doc/gnat_rm/representation_clauses_and_pragmas.rst: Correct
	size indicated for R as a component of an array.
	* gnat_rm.texi: Regenerate.

From-SVN: r272869
parent 339ff2f6
2019-07-01 Pat Rogers <rogers@adacore.com>
* doc/gnat_rm/representation_clauses_and_pragmas.rst: Correct
size indicated for R as a component of an array.
* gnat_rm.texi: Regenerate.
2019-07-01 Justin Squirek <squirek@adacore.com> 2019-07-01 Justin Squirek <squirek@adacore.com>
* libgnat/s-win32.ads: Add definition for ULONG, modify * libgnat/s-win32.ads: Add definition for ULONG, modify
......
...@@ -610,14 +610,23 @@ alignment of the type (this is true for all types). In some cases the ...@@ -610,14 +610,23 @@ alignment of the type (this is true for all types). In some cases the
end record; end record;
On a typical 32-bit architecture, the X component will be four bytes, and On a typical 32-bit architecture, the X component will occupy four bytes
require four-byte alignment, and the Y component will be one byte. In this and the Y component will occupy one byte, for a total of 5 bytes. As a
case ``R'Value_Size`` will be 40 (bits) since this is the minimum size result ``R'Value_Size`` will be 40 (bits) since this is the minimum size
required to store a value of this type, and for example, it is permissible required to store a value of this type. For example, it is permissible
to have a component of type R in an outer array whose component size is to have a component of type R in an array whose component size is
specified to be 48 bits. However, ``R'Object_Size`` will be 64 (bits), specified to be 40 bits.
since it must be rounded up so that this value is a multiple of the
alignment (4 bytes = 32 bits). However, ``R'Object_Size`` will be 64 (bits). The difference is due to
the alignment requirement for objects of the record type. The X
component will require four-byte alignment because that is what type
Integer requires, whereas the Y component, a Character, will only
require 1-byte alignment. Since the alignment required for X is the
greatest of all the components' alignments, that is the alignment
required for the enclosing record type, i.e., 4 bytes or 32 bits. As
indicated above, the actual object size must be rounded up so that it is
a multiple of the alignment value. Therefore, 40 bits rounded up to the
next multiple of 32 yields 64 bits.
For all other types, the ``Object_Size`` For all other types, the ``Object_Size``
and ``Value_Size`` are the same (and equivalent to the RM attribute ``Size``). and ``Value_Size`` are the same (and equivalent to the RM attribute ``Size``).
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
@copying @copying
@quotation @quotation
GNAT Reference Manual , Sep 24, 2018 GNAT Reference Manual , May 27, 2019
AdaCore AdaCore
...@@ -18982,14 +18982,23 @@ type R is record ...@@ -18982,14 +18982,23 @@ type R is record
end record; end record;
@end example @end example
On a typical 32-bit architecture, the X component will be four bytes, and On a typical 32-bit architecture, the X component will occupy four bytes
require four-byte alignment, and the Y component will be one byte. In this and the Y component will occupy one byte, for a total of 5 bytes. As a
case @code{R'Value_Size} will be 40 (bits) since this is the minimum size result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
required to store a value of this type, and for example, it is permissible required to store a value of this type. For example, it is permissible
to have a component of type R in an outer array whose component size is to have a component of type R in an array whose component size is
specified to be 48 bits. However, @code{R'Object_Size} will be 64 (bits), specified to be 40 bits.
since it must be rounded up so that this value is a multiple of the
alignment (4 bytes = 32 bits). However, @code{R'Object_Size} will be 64 (bits). The difference is due to
the alignment requirement for objects of the record type. The X
component will require four-byte alignment because that is what type
Integer requires, whereas the Y component, a Character, will only
require 1-byte alignment. Since the alignment required for X is the
greatest of all the components' alignments, that is the alignment
required for the enclosing record type, i.e., 4 bytes or 32 bits. As
indicated above, the actual object size must be rounded up so that it is
a multiple of the alignment value. Therefore, 40 bits rounded up to the
next multiple of 32 yields 64 bits.
For all other types, the @code{Object_Size} For all other types, the @code{Object_Size}
and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}). and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment