This is the mail archive of the gcc-patches@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] |
Tested on i686-linux, committed on trunk PR ada/20753 Minimal fix for a regression in ACATS test ce3810b. Note that a more complete fix will follow later. Fixes also the following bug: Fixed_IO.Put was raising Layout_Error when passed a string with a lower bound greater than one. There was an incorrect assumption in Put_Digit that the lower bound of Put's To parameter is zero, which is corrected by comparing Last to To'First - 1. -- The test case below must compile and execute with the following commands: gnatmake -q teststringput teststringput and generate the following output: -- Testing with seconds = 53.41 Conversion of 53.41 = '53.41' Testing with seconds = 9.9, using 1..5 Conversion of 9.9 = ' 9.90' Testing with seconds = 9.9, using 16..20 Conversion of 9.9 = ' 9.90' -- with Text_Io; procedure TestStringPut is seconds : Duration := 53.41; Str : String (1 .. 20) := (others => ' '); package Second_Io is new Text_Io.Fixed_Io (Num => Duration); begin Text_Io.Put_Line ("Testing with seconds = 53.41"); Second_Io.Put (To => Str (16 .. 20), Item => seconds, Aft => 2, Exp => 0); Text_Io.Put_Line ("Conversion of 53.41 = '" & Str (16 .. 20) & "'"); seconds := 9.9; Text_Io.Put_Line ("Testing with seconds = 9.9, using 1..5 "); Second_Io.Put (To => Str (1 .. 5), Item => seconds, Aft => 2, Exp => 0); Text_Io.Put_Line ("Conversion of 9.9 = '" & Str (1 .. 5) & "'"); Text_Io.Put_Line ("Testing with seconds = 9.9, using 16..20"); Second_Io.Put -- This call should work, but raises Layout_Error (To => Str (16 .. 20), Item => seconds, Aft => 2, Exp => 0); Text_Io.Put_Line ("Conversion of 9.9 = '" & Str (16 .. 20) & "'"); end TestStringPut; 2006-02-13 Geert Bosch <bosch@adacore.com> Gary Dismukes <dismukes@adacore.com> * a-tifiio.adb (Put_Digits): Test Last against To'First - 1 instead of 0, since the lower bound of the actual string may be greater than one. PR ada/20753 (Put): Fix condition to raise Layout_Error when invalid layout is requested.
Attachment:
difs.24
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |