Bug 17732 - Legal program rejected, RM 4.1.3(7)
Summary: Legal program rejected, RM 4.1.3(7)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: 4.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-09-29 18:20 UTC by Ludovic Brenta
Modified: 2008-08-17 12:58 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-06-14 20:26:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic Brenta 2004-09-29 18:20:16 UTC
This is Debian bug #274077, with a different title because GCC 3.4.2 and GNAT
3.15p give different symptoms.

with text_io;
procedure Test_120 is

   protected type pt1 is
      function f3 return integer;   -- overloaded
      function f4 return integer;   -- not overloaded
   end pt1;

   protected body pt1 is
      function f3 return integer is begin return 1; end;
      function f4 return integer is begin return 2; end;
   end pt1;

   protected type pt2 is
      function f3 return float;
   end pt2;

   protected body pt2 is
      function f3 return float is begin return 0.0; end;
   end pt2;

   type pt1_acc is access all pt1;
   type pt2_acc is access all pt2;

   x1: aliased pt1;
   x2: aliased pt2;
   function f1 return pt1_acc is begin return x1'access; end;
   function f1 return pt2_acc is begin return x2'access; end;

begin
   text_io.put_line(integer'image(f1.all.f4));
   text_io.put_line(integer'image(f1.f4));
   text_io.put_line(integer'image(f1.all.f3));
   text_io.put_line(integer'image(f1.f3));  -- should allow implicit .all
end Test_120;


GCC 3.4.2 gives:
test_120.adb:34:35: access type required in prefix of explicit dereference
gnatmake: "test_120.adb" compilation error

which is incorrect; the three lines above demonstrate correct behaviour.

GNAT 3.15p gives a bug box:
+===========================GNAT BUG DETECTED==============================+
| 3.15p  (20020523) (i486-pc-linux-gnu) Program_Error sem_type.adb:1348 explicit
raise|
| Error detected at test_120.adb:34:37                                     |


-- 
Ludovic Brenta.
Comment 1 Andrew Pinski 2004-11-01 01:31:34 UTC
Confirmed.
Comment 2 Samuel Tardieu 2008-08-17 12:58:59 UTC
This appears to be fixed in SVN trunk and GCC 4.3.1.