[Bug ada/16095] Illegal program not detected, X'Access of wrong type

2008-11-17 Thread sam at gcc dot gnu dot org


--- Comment #2 from sam at gcc dot gnu dot org  2008-11-17 19:56 ---
>From what I understand:

  - "access T1" is an access_definition and thus a general access type (RM
3.10(12/2))
  - "Y'Access" is of the type of its context, which should be a general access
type  (RM 3.10.2(24/1))
  - An equality operator exists for anonymous access types and is visible
because it is defined in Standard (RM 4.5.2(7.2/2))

Note that the current GCC gives no error even on the line you marked with
"error detected".

Do you agree that this bug can be closed?


-- 

sam at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |sam at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2005-06-14 04:48:37 |2008-11-17 19:56:37
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16095



[Bug ada/16095] Illegal program not detected, X'Access of wrong type

2008-11-17 Thread ludovic at ludovic-brenta dot org


--- Comment #3 from ludovic at ludovic-brenta dot org  2008-11-17 22:32 
---
The bug was open at a time when the default mode of GCC was Ada 95; gcc -gnat95
still shows the error messages for line 11 if it is uncommented.

I think the bug is legitimate in Ada 95 mode (and probably in Ada 83 mode,
too).  The example violates 3.10.2(28) because the accessibility level of Y is
deeper than that of the anonymous access type of X.

Looking at the new rules for Ada 2005, I see that 3.10.2(28) has not changed. 
The AARM even says: "28.b/2 {AI95-00230-01} If A is an anonymous
access-to-object type of an access parameter access type, then the view can
never have a deeper accessibility level than A." In the present case, A is the
anonymous type of X and "the view" is Y, which does have a deeper accessibility
level than A.

Maybe I've missed an implicit type conversion rule, new to Ada 2005, that
permits converting Y'Access to the anonymous access type of X, thereby making
the program legal in -gnat05 mode.  But in -gnat95 mode, I'm pretty confident
the program is illegal.  The error messages for line 11 could be improved quite
a lot, though.

Anyway, I can't think of a situation where X = Y'Access (short of address
representation clauses or pragma Import/Export, where all bets are off anyway),
so I believe that even if the program is legal in Ada 2005, perhaps the
compiler should warn that "=" will always return False.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16095



[Bug ada/16095] Illegal program not detected, X'Access of wrong type

2004-10-29 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

  Known to fail||4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16095


[Bug ada/16095] Illegal program not detected, X'Access of wrong type

2004-10-29 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-29 14:45 
---
Confirmed.

-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Last reconfirmed|-00-00 00:00:00 |2004-10-29 14:45:05
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16095