[Bug ada/17732] New: Legal program rejected, RM 3.1.4(7)

ludovic dot brenta at insalien dot org gcc-bugzilla@gcc.gnu.org
Wed Sep 29 18:20:00 GMT 2004


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.

-- 
           Summary: Legal program rejected, RM 3.1.4(7)
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic dot brenta at insalien dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list