Commit 915f5921 by Eric Botcazou Committed by Eric Botcazou

expr.c (expand_expr_real_1): Only use conversion between modes if both types are integral.

	* expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Only use conversion
	between modes if both types are integral.

From-SVN: r158675
parent ed0f0c0f
2010-04-23 Eric Botcazou <ebotcazou@adacore.com>
* expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Only use conversion
between modes if both types are integral.
2010-04-23 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43572
......
......@@ -9323,9 +9323,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
op0 = force_reg (GET_MODE (op0), op0);
op0 = gen_lowpart (mode, op0);
}
/* If both modes are integral, then we can convert from one to the
other. */
else if (SCALAR_INT_MODE_P (GET_MODE (op0)) && SCALAR_INT_MODE_P (mode))
/* If both types are integral, convert from one mode to the other. */
else if (INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (treeop0)))
op0 = convert_modes (mode, GET_MODE (op0), op0,
TYPE_UNSIGNED (TREE_TYPE (treeop0)));
/* As a last resort, spill op0 to memory, and reload it in a
......
2010-04-23 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/unchecked_convert5.adb: New test.
2010-04-23 Richard Guenther <rguenther@suse.de>
PR lto/41734
......
-- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
with Unchecked_Conversion;
procedure Unchecked_Convert5 is
subtype c_1 is string(1..1);
function int2c1 is -- { dg-warning "different sizes" }
new unchecked_conversion (source => integer, target => c_1);
c1 : c_1;
begin
c1 := int2c1(16#12#);
if c1 (1) /= ASCII.Nul then
raise Program_Error;
end if;
end;
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