aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2007-08-25 09:28:43 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-08-25 09:28:43 +0200
commit65fedc2c74fc2a77798553ea0dffc070c36a8773 (patch)
tree558ea6cac9d8c5ca34adea3a972cdc6a9ca494cd /gcc
parent272a4b3686f415fb0407678b7dd07102a3455f14 (diff)
downloadgcc-65fedc2c74fc2a77798553ea0dffc070c36a8773.zip
gcc-65fedc2c74fc2a77798553ea0dffc070c36a8773.tar.gz
gcc-65fedc2c74fc2a77798553ea0dffc070c36a8773.tar.bz2
expr.c (store_expr): Fix order of store_by_pieces arguments.
* expr.c (store_expr): Fix order of store_by_pieces arguments. * gcc.dg/array-init-2.c: New test. From-SVN: r127795
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/array-init-2.c51
4 files changed, 62 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cd92965..fefb4b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-25 Jakub Jelinek <jakub@redhat.com>
+
+ * expr.c (store_expr): Fix order of store_by_pieces arguments.
+
2007-08-24 Sandra Loosemore <sandra@codesourcery.com>
Nigel Stephens <nigel@mips.com>
@@ -8,7 +12,7 @@
* expr.c (SET_BY_PIECES_P): Define.
(can_store_by_pieces, store_by_pieces): Add MEMSETP argument; use
it to decide whether to use SET_BY_PIECES_P or STORE_BY_PIECES_P.
- (store_expr): Pass MEMSETP argument to can_store_by_pieces and
+ (store_expr): Pass MEMSETP argument to can_store_by_pieces and
store_by_pieces.
* expr.h (SET_RATIO): Define.
(can_store_by_pieces, store_by_pieces): Update prototypes.
diff --git a/gcc/expr.c b/gcc/expr.c
index 2446040..2112895 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4519,9 +4519,8 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
dest_mem = store_by_pieces (dest_mem,
str_copy_len, builtin_strncpy_read_str,
(void *) TREE_STRING_POINTER (exp),
- MEM_ALIGN (target),
- exp_len > str_copy_len ? 1 : 0,
- false);
+ MEM_ALIGN (target), false,
+ exp_len > str_copy_len ? 1 : 0);
if (exp_len > str_copy_len)
clear_storage (dest_mem, GEN_INT (exp_len - str_copy_len),
BLOCK_OP_NORMAL);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 11f3338..7547f4b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-25 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/array-init-2.c: New test.
+
2007-08-24 Tobias Burnus <burnus@net-b.de>
PR fortran/33178
diff --git a/gcc/testsuite/gcc.dg/array-init-2.c b/gcc/testsuite/gcc.dg/array-init-2.c
new file mode 100644
index 0000000..9c42581
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/array-init-2.c
@@ -0,0 +1,51 @@
+/* Test array initializion by store_by_pieces. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+struct A { char c[10]; };
+extern void abort (void);
+
+void
+__attribute__((noinline))
+check (struct A * a, int b)
+{
+ const char *p;
+ switch (b)
+ {
+ case 0:
+ p = "abcdefghi";
+ break;
+ case 1:
+ p = "j\0\0\0\0\0\0\0\0";
+ break;
+ case 2:
+ p = "kl\0\0\0\0\0\0\0";
+ break;
+ case 3:
+ p = "mnop\0\0\0\0\0";
+ break;
+ case 4:
+ p = "qrstuvwx\0";
+ break;
+ default:
+ abort ();
+ }
+ if (__builtin_memcmp (a->c, p, 10) != 0)
+ abort ();
+}
+
+int
+main (void)
+{
+ struct A a = { "abcdefghi" };
+ check (&a, 0);
+ struct A b = { "j" };
+ check (&b, 1);
+ struct A c = { "kl" };
+ check (&c, 2);
+ struct A d = { "mnop" };
+ check (&d, 3);
+ struct A e = { "qrstuvwx" };
+ check (&e, 4);
+ return 0;
+}