OSDN Git Service

2009-04-17 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Apr 2009 12:36:38 +0000 (12:36 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Apr 2009 12:36:38 +0000 (12:36 +0000)
* exp_ch5.adb (Expand_Assign_Array): Do not set Forwards_OK and
Backwards_OK if either operand has an address clause.

2009-04-17  Pascal Obry  <obry@adacore.com>

* initialize.c: Code clean up, use realloc.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146259 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_ch5.adb
gcc/ada/initialize.c

index edb0bab..5b8d3a1 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-17  Robert Dewar  <dewar@adacore.com>
+
+       * exp_ch5.adb (Expand_Assign_Array): Do not set Forwards_OK and
+       Backwards_OK if either operand has an address clause.
+
+2009-04-17  Pascal Obry  <obry@adacore.com>
+
+       * initialize.c: Code clean up, use realloc.
+
 2009-04-17  Pascal Obry  <obry@adacore.com>
 
        * initialize.c: Do not get Unicode command line if Unicode support not
index b51e8d2..c025f58 100644 (file)
@@ -308,6 +308,19 @@ package body Exp_Ch5 is
          --  can be performed directly.
       end if;
 
+      --  If either operand has an address clause clear Backwards_OK and
+      --  Forwards_OK, since we cannot tell if the operands overlap.
+
+      if (Is_Entity_Name (Lhs)
+           and then Present (Address_Clause (Entity (Lhs))))
+        or else
+         (Is_Entity_Name (Lhs)
+          and then Present (Address_Clause (Entity (Lhs))))
+      then
+         Set_Forwards_OK  (N, False);
+         Set_Backwards_OK (N, False);
+      end if;
+
       --  We certainly must use a loop for change of representation and also
       --  we use the operand of the conversion on the right hand side as the
       --  effective right hand side (the component types must match in this
index 67e2acd..5a1417b 100644 (file)
@@ -45,6 +45,7 @@
 #include "tsystem.h"
 /* We don't have libiberty, so use malloc.  */
 #define xmalloc(S) malloc (S)
+#define xrealloc(V,S) realloc (V,S)
 #else
 #include "config.h"
 #include "system.h"
@@ -83,17 +84,8 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last)
 
   if (*last < *index)
     {
-      char **old_argv = *argv;
-      int old_last = *last;
-      int k;
-
       *last += EXPAND_ARGV_RATE;
-      *argv = (char **) xmalloc ((*last) * sizeof (char *));
-
-      for (k=0; k<=old_last; k++)
-       (*argv)[k] = old_argv[k];
-
-      free (old_argv);
+      *argv = (char **) xrealloc (*argv, (*last) * sizeof (char *));
     }
 
   size = WS2SC (NULL, value, 0);
@@ -102,20 +94,6 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last)
 
   (*index)++;
 }
-
-static void
-adjust_arg (int last, char ***argv)
-{
-  char **old_argv = *argv;
-  int k;
-
-  *argv = (char **) xmalloc (last * sizeof (char *));
-
-  for (k=0; k<last; k++)
-    (*argv)[k] = old_argv[k];
-
-  free (old_argv);
-}
 #endif
 
 void
@@ -200,7 +178,8 @@ __gnat_initialize (void *eh)
 
         LocalFree (wargv);
         gnat_argc = argc_expanded;
-        adjust_arg (argc_expanded, &gnat_argv);
+        gnat_argv = (char **) xrealloc
+          (gnat_argv, argc_expanded * sizeof (char *));
        }
    }
 #endif