calls.c (shift_returned_value): Fix handling of non-integer TYPE_MODEs.

* calls.c (shift_returned_value): Fix handling of non-integer
	TYPE_MODEs.

From-SVN: r83595
This commit is contained in:
Richard Sandiford 2004-06-24 15:30:07 +00:00 committed by Richard Sandiford
parent 061cae1fa9
commit 5a1f395394
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-06-24 Richard Sandiford <rsandifo@redhat.com>
* calls.c (shift_returned_value): Fix handling of non-integer
TYPE_MODEs.
2004-06-24 Ulrich Weigand <uweigand@de.ibm.com>
* c-decl.c (finish_function): Do not check for DEFAULT_MAIN_RETURN.

View File

@ -1920,9 +1920,17 @@ shift_returned_value (tree type, rtx *value)
- BITS_PER_UNIT * int_size_in_bytes (type));
if (shift > 0)
{
/* Shift the value into the low part of the register. */
*value = expand_binop (GET_MODE (*value), lshr_optab, *value,
GEN_INT (shift), 0, 1, OPTAB_WIDEN);
*value = convert_to_mode (TYPE_MODE (type), *value, 0);
/* Truncate it to the type's mode, or its integer equivalent.
This is subject to TRULY_NOOP_TRUNCATION. */
*value = convert_to_mode (int_mode_for_mode (TYPE_MODE (type)),
*value, 0);
/* Now convert it to the final form. */
*value = gen_lowpart (TYPE_MODE (type), *value);
return true;
}
}

View File

@ -1,3 +1,7 @@
2004-06-24 Richard Sandiford <rsandifo@redhat.com>
* gcc.c-torture/compile/20040624-1.c: New test.
2004-06-24 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* g++.dg/tree-ssa/tree-ssa.exp: Remove. dg.exp already handles

View File

@ -0,0 +1,3 @@
struct s { float f[1]; };
struct s foo();
float bar() { return foo().f[0]; }