Commit 65fedc2c by Jakub Jelinek

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
parent 272a4b36
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> 2007-08-24 Sandra Loosemore <sandra@codesourcery.com>
Nigel Stephens <nigel@mips.com> Nigel Stephens <nigel@mips.com>
...@@ -8,7 +12,7 @@ ...@@ -8,7 +12,7 @@
* expr.c (SET_BY_PIECES_P): Define. * expr.c (SET_BY_PIECES_P): Define.
(can_store_by_pieces, store_by_pieces): Add MEMSETP argument; use (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. 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. store_by_pieces.
* expr.h (SET_RATIO): Define. * expr.h (SET_RATIO): Define.
(can_store_by_pieces, store_by_pieces): Update prototypes. (can_store_by_pieces, store_by_pieces): Update prototypes.
......
...@@ -4519,9 +4519,8 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal) ...@@ -4519,9 +4519,8 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
dest_mem = store_by_pieces (dest_mem, dest_mem = store_by_pieces (dest_mem,
str_copy_len, builtin_strncpy_read_str, str_copy_len, builtin_strncpy_read_str,
(void *) TREE_STRING_POINTER (exp), (void *) TREE_STRING_POINTER (exp),
MEM_ALIGN (target), MEM_ALIGN (target), false,
exp_len > str_copy_len ? 1 : 0, exp_len > str_copy_len ? 1 : 0);
false);
if (exp_len > str_copy_len) if (exp_len > str_copy_len)
clear_storage (dest_mem, GEN_INT (exp_len - str_copy_len), clear_storage (dest_mem, GEN_INT (exp_len - str_copy_len),
BLOCK_OP_NORMAL); BLOCK_OP_NORMAL);
......
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> 2007-08-24 Tobias Burnus <burnus@net-b.de>
PR fortran/33178 PR fortran/33178
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment