public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/108157] New: [12/13 regression] object subtype doesn't statically match designated subtype
@ 2022-12-17 20:00 simon at pushface dot org
  2022-12-19  8:04 ` [Bug ada/108157] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: simon at pushface dot org @ 2022-12-17 20:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108157

            Bug ID: 108157
           Summary: [12/13 regression] object subtype doesn't statically
                    match designated subtype
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54118
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54118&action=edit
Demonstrator

The attached code fails with

   $ /opt/gcc-12.2.0/bin/gcc -c g-socser.adb
   g-socser.adb:13:22: error: object subtype must statically match designated
subtype

The relevant part of g-socser.adb:

     9.       Connect_Socket
    10.         (Socket   => Client.Socket,
    11.          Server   => Client.Client_Address,
    12.          Timeout  => 0.0,
    13.          Selector => Listener.Selector'Unchecked_Access,
                             |
        >>> error: object subtype must statically match designated subtype

The relevant part of g-socser.ads:

    20.    type Connections_Server is tagged limited record
    21.       --  limited because Selector_Type is limited
    22.       Selector : aliased Selector_Type;
    23.    end record;

The relevant part of the GNAT standard library GNAT.Sockets is

   procedure Connect_Socket
     (Socket   : Socket_Type;
      Server   : Sock_Addr_Type;
      Timeout  : Selector_Duration;
      Selector : access Selector_Type := null;
      Status   : out Selector_Status);

and it’s the same Selector_Type all the way.

I’ve looked at Annotated Ada Reference Manual (Ada 2022 Draft 34) 4.9.1[1] and
I can’t see what the problem is.

Note, I don’t know why the code uses 'Unchecked_Access; 'Access gives the same
error, 'Unrestricted_Access compiles OK.

[1] http://www.ada-auth.org/standards/22aarm/html/AA-4-9-1.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-11 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17 20:00 [Bug ada/108157] New: [12/13 regression] object subtype doesn't statically match designated subtype simon at pushface dot org
2022-12-19  8:04 ` [Bug ada/108157] " rguenth at gcc dot gnu.org
2023-05-08 12:26 ` [Bug ada/108157] [12/13/14 " rguenth at gcc dot gnu.org
2023-05-10 11:07 ` simon at pushface dot org
2023-05-11 12:33 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).