This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GNAT: Handling of Freezing Rules
- From: Reinhold May <reinhold dot may at gmx dot de>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 20 Apr 2004 15:24:11 +0100
- Subject: GNAT: Handling of Freezing Rules
I've compiled an example containing the following code using the
Green Hills Ada compiler without a problem.
var : var_type;
for var'address use get_address(var'size, var'alignment);
(assuming that 'get_address' is a function returning a value of
type 'System.Address')
Gnat fails returning:
representation item appears too late
Reading the Ada Language Reference Manual 13.14 (4) about
'Freezing Rules' I can kind of imagine why Gnat might not
compile that:
"[...] A construct that (explicitly of implicitly) references
an entity can cause the freezing of the entity, as defined by
a subsequent paragraphs. [...]"
But in my opinion reading attributes doesn't necessarily
constitute 'referencing an entity' (the variable). I think, the
attributes 'address, 'size and 'alignment are independent from
each other and should be allowed to be used in order to
configure each other in a representation clause. Thus, in my
opinion Gnat should compile the code above.
What do others think?