This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]