aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-17 14:36:38 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-17 14:36:38 +0200
commit01cd0938b55019565dd76224d0b20edfbd496cc6 (patch)
tree8e3f5153616f35081215515fe235b0a769bb93a5
parent46e26fe337a12800faa9ef010eebb49266a014f7 (diff)
downloadgcc-01cd0938b55019565dd76224d0b20edfbd496cc6.zip
gcc-01cd0938b55019565dd76224d0b20edfbd496cc6.tar.gz
gcc-01cd0938b55019565dd76224d0b20edfbd496cc6.tar.bz2
[multiple changes]
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. From-SVN: r146259
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/exp_ch5.adb13
-rw-r--r--gcc/ada/initialize.c29
3 files changed, 26 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index edb0bab..5b8d3a1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index b51e8d2..c025f58 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -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
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 67e2acd..5a1417b 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -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