Ada RM requires that procedure Text_IO_Get_Line sets Last to
Item'First - 1 when parameter Item is the empty string, which was not
performed until now.

Tested on x86_64-pc-linux-gnu, committed on trunk

2016-05-02  Yannick Moy  <m...@adacore.com>

        * a-tigeli.adb (Get_Line): Always set Last prior to returning.

Index: a-tigeli.adb
===================================================================
--- a-tigeli.adb        (revision 235710)
+++ a-tigeli.adb        (working copy)
@@ -150,6 +150,12 @@
 begin
    FIO.Check_Read_Status (AP (File));
 
+   --  Set Last to Item'First - 1 when no characters are read, as mandated by
+   --  Ada RM. In the case where Item'First is negative or null, this results
+   --  in Constraint_Error being raised.
+
+   Last := Item'First - 1;
+
    --  Immediate exit for null string, this is a case in which we do not
    --  need to test for end of file and we do not skip a line mark under
    --  any circumstances.
@@ -160,8 +166,6 @@
 
    N := Item'Last - Item'First + 1;
 
-   Last := Item'First - 1;
-
    --  Here we have at least one character, if we are immediately before
    --  a line mark, then we will just skip past it storing no characters.
 

Reply via email to