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

* [Bug ada/108157] [12/13 regression] object subtype doesn't statically match designated subtype
  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 ` rguenth at gcc dot gnu.org
  2023-05-08 12:26 ` [Bug ada/108157] [12/13/14 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-19  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
           Priority|P3                          |P4
           Keywords|                            |rejects-valid

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

* [Bug ada/108157] [12/13/14 regression] object subtype doesn't statically match designated subtype
  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 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |12.4

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.

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

* [Bug ada/108157] [12/13/14 regression] object subtype doesn't statically match designated subtype
  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
  3 siblings, 0 replies; 5+ messages in thread
From: simon at pushface dot org @ 2023-05-10 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from simon at pushface dot org ---
Still present in 13.1.0.

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

* [Bug ada/108157] [12/13/14 regression] object subtype doesn't statically match designated subtype
  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
                   ` (2 preceding siblings ...)
  2023-05-10 11:07 ` simon at pushface dot org
@ 2023-05-11 12:33 ` ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-05-11 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
        --  Ada 2005 (AI-363): Require static matching when designated
        --  type has discriminants and a constrained partial view, since
        --  in general objects of such types are mutable, so we can't
        --  allow the access value to designate a constrained object
        --  (because access values must be assumed to designate mutable
        --  objects when designated type does not impose a constraint).

^ 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).