From: jakub Date: Sat, 11 Jul 2009 09:23:32 +0000 (+0000) Subject: PR target/40668 X-Git-Tag: upstream/4.9.2~34926 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=738ab6f51ce3bb0ec1b2ee03249a0738db98b0cf;p=platform%2Fupstream%2Flinaro-gcc.git PR target/40668 * function.c (assign_parm_setup_stack): Adjust MEM_OFFSET (data->stack_parm) if promoted_mode is different from nominal_mode on big endian. * gcc.c-torture/execute/pr40668.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149511 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e62635..17bb0cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-07-11 Jakub Jelinek + + PR target/40668 + * function.c (assign_parm_setup_stack): Adjust + MEM_OFFSET (data->stack_parm) if promoted_mode is different + from nominal_mode on big endian. + 2009-07-11 Paolo Bonzini * expmed.c (emit_store_flag_1): Fix choice of zero vs. sign extension. diff --git a/gcc/function.c b/gcc/function.c index 93244db..258f594 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2976,9 +2976,17 @@ assign_parm_setup_stack (struct assign_parm_data_all *all, tree parm, TYPE_UNSIGNED (TREE_TYPE (parm))); if (data->stack_parm) - /* ??? This may need a big-endian conversion on sparc64. */ - data->stack_parm - = adjust_address (data->stack_parm, data->nominal_mode, 0); + { + int offset = subreg_lowpart_offset (data->nominal_mode, + GET_MODE (data->stack_parm)); + /* ??? This may need a big-endian conversion on sparc64. */ + data->stack_parm + = adjust_address (data->stack_parm, data->nominal_mode, 0); + if (offset && MEM_OFFSET (data->stack_parm)) + set_mem_offset (data->stack_parm, + plus_constant (MEM_OFFSET (data->stack_parm), + offset)); + } } if (data->entry_parm != data->stack_parm) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a477b3..87d5708 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-07-11 Jakub Jelinek + + PR target/40668 + * gcc.c-torture/execute/pr40668.c: New test. + 2009-07-11 Paolo Bonzini * gcc.c-torture/execute/20090711-1.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40668.c b/gcc/testsuite/gcc.c-torture/execute/pr40668.c new file mode 100644 index 0000000..70fe63f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40668.c @@ -0,0 +1,35 @@ +static void +foo (unsigned int x, void *p) +{ + __builtin_memcpy (p, &x, sizeof x); +} + +void +bar (int type, void *number) +{ + switch (type) + { + case 1: + foo (0x12345678, number); + break; + case 7: + foo (0, number); + break; + case 8: + foo (0, number); + break; + case 9: + foo (0, number); + break; + } +} + +int +main (void) +{ + unsigned int x; + bar (1, &x); + if (x != 0x12345678) + __builtin_abort (); + return 0; +}