g-os_lib.adb (Add_To_Command): use explicit loop to move string into Command, an...
authorEd Schonberg <schonber@gnat.com>
Thu, 29 Nov 2001 05:15:53 +0000 (05:15 +0000)
committerGeert Bosch <bosch@gcc.gnu.org>
Thu, 29 Nov 2001 05:15:53 +0000 (06:15 +0100)
* g-os_lib.adb (Add_To_Command): use explicit loop to move string
into Command, an array conversion is illegal here. Uncovered by
ACATS B460005.

From-SVN: r47435

gcc/ada/ChangeLog
gcc/ada/g-os_lib.adb

index 3bcc433032ca69e64ac10b5f601cc7de5a659296..8c501db096f3e81098bfbe53370f5cf15448a2aa 100644 (file)
@@ -1,3 +1,9 @@
+2001-11-29  Ed Schonberg <schonber@gnat.com>
+
+       * g-os_lib.adb (Add_To_Command): use explicit loop to move string 
+       into Command, an array conversion is illegal here. Uncovered by 
+       ACATS B460005.
+
 2001/11/28  Geert Bosch <bosch@gnat.com>
 
        * init.c: Minor whitespace changes.
index cc600789e1dc716fca2045f996a25da5c31423eb..3c352366acbf9a0c408fb9dd3965ae46990359fd 100644 (file)
@@ -1316,7 +1316,13 @@ package body GNAT.OS_Lib is
 
       begin
          Command_Last := Command_Last + S'Length;
-         Command (First .. Command_Last) := Chars (S);
+
+         --  Move characters one at a time, because Command has
+         --  aliased components.
+
+         for J in S'Range loop
+            Command (First + J - S'First) := S (J);
+         end loop;
 
          Command_Last := Command_Last + 1;
          Command (Command_Last) := ASCII.NUL;