From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a27864f6019f6e7f X-Google-Attributes: gid103376,public From: Vincent Marciante Subject: Simpler Question (was Assigning to dereferenced null access variable) Date: 2000/11/07 Message-ID: <3A0847ED.49AF@li.net>#1/1 X-Deja-AN: 690881848 Content-Transfer-Encoding: 7bit References: <3A05A609.4CE6@li.net> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 973621215 209.139.0.74 (Tue, 07 Nov 2000 18:20:15 GMT) Organization: Verio MIME-Version: 1.0 NNTP-Posting-Date: Tue, 07 Nov 2000 18:20:15 GMT Newsgroups: comp.lang.ada Date: 2000-11-07T00:00:00+00:00 List-Id: --Okay, I cut down the question to: -- --Why don't both blocks in the following code behave similarly? --I get the following output using OS/2 GNAT 3.12p -- --The Null_Characters(1..0) assignment succeeded --The Null_Characters assignment caused Constraint_Error -- --If the above indicates a compiler defect then what is the --correct behavior? with Ada.Text_IO; use Ada.Text_IO; procedure Test_Null_Assignments is type Characters is array (Positive range <>) of Character; Null_Characters : Characters(1..0); type Reference is access Characters; type Character_Sequence is record The_Characters : Reference; end record; Null_Sequence : Character_Sequence; begin begin Null_Sequence.The_Characters(1..0) := Null_Characters(1..0); Put_Line("The Null_Characters(1..0) assignment succeeded"); --OS/2 GNAT 3.12 succeeds exception when Constraint_Error => Put_Line("The Null_Characters(1..0) assignment caused Constraint_Error"); end; begin Null_Sequence.The_Characters(1..0) := Null_Characters; Put_Line("The Null_Characters assignment succeeded"); exception when Constraint_Error => Put_Line("The Null_Characters assignment caused Constraint_Error"); --OS/2 GNAT 3.12 raises Constraint_Error end; end;