public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/34366]  New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005
@ 2007-12-06 21:05 ludovic at ludovic-brenta dot org
  2007-12-06 23:35 ` [Bug ada/34366] " sam at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ludovic at ludovic-brenta dot org @ 2007-12-06 21:05 UTC (permalink / raw)
  To: gcc-bugs

package test2 is
  pragma elaborate_body;

    type T is record
        F1: access function(x: integer) return T;
        F2: access function(x: T) return integer;             --??
        F3: access function(x: T) return T;                   --??
        F4: access function(x: integer) return access T;      --??
        F5: access function(x: access T) return integer;
        F6: access function(x: access T) return access T;
        F7: access function(x: T) return access T;            --??
        F8: access function(x: access T) return T;
    end record;

end test2;

package body test2 is

    R: aliased T;

    function F1 (x: integer) return T         is begin return R; end;
    function F2 (x: T) return integer         is begin return 0; end;
    function F3 (x: T) return T               is begin return R; end;
    function F4 (x: integer) return access T  is begin return R'access; end;
    function F5 (x: access T) return integer  is begin return 0; end;
    function F6 (x: access T) return access T is begin return R'access; end;
    function F7 (x: T) return access T        is begin return R'access; end;
    function F8 (x: access T) return T        is begin return R; end;

begin
    R.F1 := F1'Access;
    R.F2 := F2'Access;
    R.F3 := F3'Access;
    R.F4 := F4'Access;
    R.F5 := F5'Access;
    R.F6 := F6'Access;
    R.F7 := F7'Access;
    R.F8 := F8'Access;
end test2;

In both GCC 4.1.2 and 4.2.2 the symptoms are the same:

gnatmake -gnat05 test2
gcc-4.1 -c -gnat05 test2.adb
test2.adb:17:15: expected type access to type derived from "Standard.Integer"
defined at test2.ads:6
test2.adb:17:15: found type access to "f2" defined at line 17
test2.adb:18:15: expected type access to type derived from "t" defined at
test2.ads:7
test2.adb:18:15: found type access to "f3" defined at line 18
test2.adb:19:15: found type access to "f4" defined at line 19
test2.adb:20:15: expected an access type with designated type derived from
"Standard.Integer" defined at test2.ads:4
test2.adb:20:15: found an access type with designated type "F5" defined at line
10
test2.adb:21:15: expected an access type with designated type derived from
access to "t" defined at test2.ads:4
test2.adb:21:15: found an access type with designated type "F6" defined at line
11
test2.adb:22:15: found type access to "f7" defined at line 22
test2.adb:23:15: expected an access type with designated type derived from "t"
defined at test2.ads:4
test2.adb:23:15: found an access type with designated type "F8" defined at line
13
test2.ads:6:32: type declaration cannot refer to itself
test2.ads:7:32: type declaration cannot refer to itself
test2.ads:8:55: type declaration cannot refer to itself
test2.ads:11:32: type declaration cannot refer to itself
test2.ads:11:49: type declaration cannot refer to itself
gnatmake: "test2.adb" compilation error

Note how the assignment to R.F1 gives no error message.

In assignments with error messages, the compiler incorrectly expects the
right-hand side of the assignment to have an access type to the return value of
the function; not the access-to-subprogram type.


-- 
           Summary: Legal program rejected, various anonymous access-to-
                    subprogram types, Ada 2005
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


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


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

* [Bug ada/34366] Legal program rejected, various anonymous access-to-subprogram types, Ada 2005
  2007-12-06 21:05 [Bug ada/34366] New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005 ludovic at ludovic-brenta dot org
@ 2007-12-06 23:35 ` sam at gcc dot gnu dot org
  2007-12-07  2:54 ` sam at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-06 23:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sam at gcc dot gnu dot org  2007-12-06 23:35 -------
Confirmed on 4.3.0 20071206


-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-06 23:35:41
               date|                            |


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


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

* [Bug ada/34366] Legal program rejected, various anonymous access-to-subprogram types, Ada 2005
  2007-12-06 21:05 [Bug ada/34366] New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005 ludovic at ludovic-brenta dot org
  2007-12-06 23:35 ` [Bug ada/34366] " sam at gcc dot gnu dot org
@ 2007-12-07  2:54 ` sam at gcc dot gnu dot org
  2007-12-09 11:08 ` sam at gcc dot gnu dot org
  2007-12-09 11:09 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-07  2:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sam at gcc dot gnu dot org  2007-12-07 02:54 -------
Confirmed on 4.3.0 20071206


-- 

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|2007-12-06 23:35:41         |2007-12-07 02:54:43
               date|                            |


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


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

* [Bug ada/34366] Legal program rejected, various anonymous access-to-subprogram types, Ada 2005
  2007-12-06 21:05 [Bug ada/34366] New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005 ludovic at ludovic-brenta dot org
  2007-12-06 23:35 ` [Bug ada/34366] " sam at gcc dot gnu dot org
  2007-12-07  2:54 ` sam at gcc dot gnu dot org
@ 2007-12-09 11:08 ` sam at gcc dot gnu dot org
  2007-12-09 11:09 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-09 11:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sam at gcc dot gnu dot org  2007-12-09 11:08 -------
Subject: Bug 34366

Author: sam
Date: Sun Dec  9 11:07:54 2007
New Revision: 130720

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130720
Log:
    gcc/ada/
        PR ada/34366
        * sem_ch3.adb (Designates_T): New function.
        (Mentions_T): Factor reusable part of the logic into Designates_T.
        Consider non-access parameters and access and non-access result.
        (Check_Anonymous_Access_Components): Set ekind of anonymous access to
        E_Subprogram_Type to E_Anonymous_Access_Subprogram_Type.

        * einfo.ads: Update comment for E_Anonymous_Access_Subprogram_Type.

    gcc/testsuite/
        PR ada/34366
        * gnat.dg/enclosing_record_reference.ads,
        gnat.dg/enclosing_record_reference.adb: New test.

Added:
    trunk/gcc/testsuite/gnat.dg/enclosing_record_reference.adb
    trunk/gcc/testsuite/gnat.dg/enclosing_record_reference.ads
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/einfo.ads
    trunk/gcc/ada/sem_ch3.adb
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug ada/34366] Legal program rejected, various anonymous access-to-subprogram types, Ada 2005
  2007-12-06 21:05 [Bug ada/34366] New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005 ludovic at ludovic-brenta dot org
                   ` (2 preceding siblings ...)
  2007-12-09 11:08 ` sam at gcc dot gnu dot org
@ 2007-12-09 11:09 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-09 11:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from sam at gcc dot gnu dot org  2007-12-09 11:09 -------
Fixed in SVN trunk


-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-12-09 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 21:05 [Bug ada/34366] New: Legal program rejected, various anonymous access-to-subprogram types, Ada 2005 ludovic at ludovic-brenta dot org
2007-12-06 23:35 ` [Bug ada/34366] " sam at gcc dot gnu dot org
2007-12-07  2:54 ` sam at gcc dot gnu dot org
2007-12-09 11:08 ` sam at gcc dot gnu dot org
2007-12-09 11:09 ` sam at gcc dot gnu dot 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).