GNAT: Handling of Freezing Rules
Reinhold May
reinhold.may@gmx.de
Tue Apr 20 16:01:00 GMT 2004
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?
More information about the Gcc
mailing list