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]

[PATCH] Fix GCC 3.4.x libgnat, so that Ada can be bootstrapped starting from GCC 3.4.x Ada


Hi!

Details in the PR.  U (and thus U.Reference too) are marked RTX_UNCHANGING_P,
as it is a read-only argument.  When a-stunau.adb is compiled with -O2,
return U.Reference; uses the Old value instead of the newly allocated
string.
Ok for 3.4/trunk if testing succeeds?

2005-01-17  Jakub Jelinek  <jakub@redhat.com>

	PR ada/13470
	* a-stunau.adb (Get_String): Don't return U.Reference, but Ret that is
	set to the new string.

--- gcc/ada/a-stunau.adb.jj	2003-10-23 09:54:48.000000000 +0200
+++ gcc/ada/a-stunau.adb	2005-01-17 15:40:46.958801834 +0100
@@ -53,11 +53,13 @@ package body Ada.Strings.Unbounded.Aux i
             --  would not be possible otherwise as U is read-only.
 
             Old : String_Access := U.Reference;
+            Ret : String_Access;
 
          begin
-            U_Ptr.Reference := new String'(U.Reference (1 .. U.Last));
+            Ret := new String'(U.Reference (1 .. U.Last));
+            U_Ptr.Reference := Ret;
             Free (Old);
-            return U.Reference;
+            return Ret;
          end;
       end if;
    end Get_String;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]