[Bug ada/18455] New: Legal rejected in gnat 3.15p, RM 3.10(15); incorrect execution in gcc 3.4.2

ludovic dot brenta at insalien dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 12 16:39:00 GMT 2004


(Debian bug #280940)

-- RM 3.10(15)  "An access value satisfies a composite_constraint
-- of an access subtype if it ... designates an object whose value
-- satisfies the constraint."

with text_io;
procedure Test_131 is
   type string_ptr is access all string;
   subtype str10 is string_Ptr(1..10);
   xstr20: aliased string := (1..20 => 'a');
   xstr10: str10;
begin
   xstr10 := xstr20'Access; -- line 12
   text_io.put_line("FAILED, constraint_error not raised");
exception
   when constraint_error =>
     text_io.put_line("PASSED, constraint_error raised");
end Test_131;


Expected output: the compiler says nothing, the program prints:
PASSED, constraint_error raised

Actual output with gnat 3.15p:

test_131.adb:12:14: object subtype must statically match designated subtype
gnatmake: "test_131.adb" compilation error

which is incorrect.  With gnat-3.4 3.4.2-2, the compiler says nothing
(correct) but the program runs and outputs:

FAILED, constraint_error not raised

-- 
           Summary: Legal rejected in gnat 3.15p, RM 3.10(15); incorrect
                    execution in gcc 3.4.2
           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=18455



More information about the Gcc-bugs mailing list