This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/15805] New: Illegal program not detected, allows writing through access to constant


(Debian bug #246387)

with text_io;
procedure Test_246387 is

   c: aliased constant integer := 3;

   type const_ptr is access constant integer;
   cp : const_ptr := c'access;

   procedure inc(var_ptr: access integer := cp) is
   begin
      var_ptr.all := var_ptr.all + 1;
   end inc;

begin
   text_io.put_line(integer'image(cp.all));
   inc;
   text_io.put_line(integer'image(cp.all));
end Test_246387;


I expect:
test_246387.adb:9:44: incompatible types; expected "access integer", received
"const_ptr"

But I get nothing.

-- 
           Summary: Illegal program not detected, allows writing through
                    access to constant
           Product: gcc
           Version: 3.4.0
            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=15805


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]