comp.lang.ada
 help / color / mirror / Atom feed
From: erik.shadwick@gmail.com
Subject: GNAT bugs around use of "for X'Address..." clause
Date: Thu, 21 May 2015 23:23:35 -0700 (PDT)
Date: 2015-05-21T23:23:35-07:00	[thread overview]
Message-ID: <c0275141-4bdc-4e47-bb01-c7af6f774926@googlegroups.com> (raw)

Consider the following declarations:

package P is
   type Checked_T is private
     with Type_Invariant => Check (Checked_T);

   type Tagged_T is tagged private;

   type Checked_Tagged_T is tagged private
     with Type_Invariant => Check (Checked_Tagged_T);

     function Check (M : Checked_T)        return Boolean with Inline;
     function Check (M : Checked_Tagged_T) return Boolean with Inline;

private
   type Checked_T is null record;
   type Tagged_T is tagged null record;
   type Checked_Tagged_T is tagged null record;

   function Check (M : Checked_T) return Boolean is (True);
   function Check (M : Checked_Tagged_T) return Boolean is (True);

end P;


Then the following 3 declarations each produce [similar] GNAT BUG DETECTED output:

X : P.Checked_T;
for X'Address use System.Null_Address;
--  However, if I do something like:
--     V : P.Checked_T;
--     X : P.Checked_T := V;
--     for X'Address use ...;
--  then no bug surfaces.

W : P.Tagged_T;
Y : P.Tagged_T := W;
for Y'Address use System.Null_Address;
--  If I do not perform the ":= W", then it works fine.
    
Z : P.Checked_Tagged_T;
for Z'Address use System.Null_Address;
--  With or without assignment to Z in its declaration, it fails.


(Compiled with `gnatmake -gnat2012`, with "GPL 2014 (20140331) (x86_64-apple-darwin12.5.0)")

Should I be submitting this to AdaCore, or GCC's http://gcc.gnu.org/bugs.html bug tracker? When running this with my copy of GNAT free/GPL, it suggests the former, but when compiling it through ideone.com I get the message to put it into GCC's tracker. It detects the error in "in gnat_to_gnu_entity, at ada/gcc-interface/decl.c:347".

Further, what is the validity of assigning to a variable that has the 'Address clause on it -- is it legal and defined behaviour?

--
Erik Shadwick


             reply	other threads:[~2015-05-22  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  6:23 erik.shadwick [this message]
2015-05-22  7:38 ` GNAT bugs around use of "for X'Address..." clause Simon Wright
2015-05-22  8:08   ` erik.shadwick
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox