Commit b83c4036 by Roger Sayle

fold-const.c (fold): Use the original type conversion tree code rather than call fold_convert...


	* fold-const.c (fold) <NOP_EXPR>: Use the original type conversion
	tree code rather than call fold_convert, which doesn't specify a
	default floating point to integer conversion.

	* gcc.c-torture/compile/20040209-1.c: New test case.

From-SVN: r77535
parent 12001e0f
2004-02-09 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold) <NOP_EXPR>: Use the original type conversion
tree code rather than call fold_convert, which doesn't specify a
default floating point to integer conversion.
2004-02-08 Bernardo Innocenti <bernie@develer.com> 2004-02-08 Bernardo Innocenti <bernie@develer.com>
* config/m68k/m68k.c, config/m68k/m68k.md (SGS, SGS_CMP_ORDER): Remove * config/m68k/m68k.c, config/m68k/m68k.md (SGS, SGS_CMP_ORDER): Remove
code to support SGS assembler. Reformat adjacent code where possible. code to support SGS assembler. Reformat adjacent code where possible.
* config/m68k/m68k.c (switch_table_difference_label_flag): Remove definition. * config/m68k/m68k.c (switch_table_difference_label_flag): Remove
* config/m68k/m68k.h (PRINT_OPERAND_PUNCT_VALID_P): Remove support for '%#'. definition.
* config/m68k/m68k.h (PRINT_OPERAND_PUNCT_VALID_P): Remove support
for '%#'.
* config/m68k/linux.h, config/m68k/m68k.c, * config/m68k/linux.h, config/m68k/m68k.c,
* config/m68k/math-68881.h: Replace `%#' with `#' in inline asm macros and * config/m68k/math-68881.h: Replace `%#' with `#' in inline asm
asm_printf() format strings. macros and asm_printf() format strings.
* config/m68k/m68kelf.h (ASM_OUTPUT_CASE_END): Remove macro definition. * config/m68k/m68kelf.h (ASM_OUTPUT_CASE_END): Remove macro definition.
* config/m68k/linux.h: Update copyright. * config/m68k/linux.h: Update copyright.
* config/m68k/linux.h, config/m68k/m68k.c: Remove traling whitespace. * config/m68k/linux.h, config/m68k/m68k.c: Remove traling whitespace.
......
...@@ -5641,8 +5641,8 @@ fold (tree expr) ...@@ -5641,8 +5641,8 @@ fold (tree expr)
if (TYPE_MAIN_VARIANT (inside_type) == TYPE_MAIN_VARIANT (final_type) if (TYPE_MAIN_VARIANT (inside_type) == TYPE_MAIN_VARIANT (final_type)
&& ((inter_int && final_int) || (inter_float && final_float)) && ((inter_int && final_int) || (inter_float && final_float))
&& inter_prec >= final_prec) && inter_prec >= final_prec)
return fold_convert (final_type, return fold (build1 (code, final_type,
TREE_OPERAND (TREE_OPERAND (t, 0), 0)); TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* Likewise, if the intermediate and final types are either both /* Likewise, if the intermediate and final types are either both
float or both integer, we don't need the middle conversion if float or both integer, we don't need the middle conversion if
...@@ -5657,16 +5657,16 @@ fold (tree expr) ...@@ -5657,16 +5657,16 @@ fold (tree expr)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type)) && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
&& TYPE_MODE (final_type) == TYPE_MODE (inter_type)) && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
&& ! final_ptr) && ! final_ptr)
return fold_convert (final_type, return fold (build1 (code, final_type,
TREE_OPERAND (TREE_OPERAND (t, 0), 0)); TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* If we have a sign-extension of a zero-extended value, we can /* If we have a sign-extension of a zero-extended value, we can
replace that by a single zero-extension. */ replace that by a single zero-extension. */
if (inside_int && inter_int && final_int if (inside_int && inter_int && final_int
&& inside_prec < inter_prec && inter_prec < final_prec && inside_prec < inter_prec && inter_prec < final_prec
&& inside_unsignedp && !inter_unsignedp) && inside_unsignedp && !inter_unsignedp)
return fold_convert (final_type, return fold (build1 (code, final_type,
TREE_OPERAND (TREE_OPERAND (t, 0), 0)); TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* Two conversions in a row are not needed unless: /* Two conversions in a row are not needed unless:
- some conversion is floating-point (overstrict for now), or - some conversion is floating-point (overstrict for now), or
...@@ -5690,8 +5690,8 @@ fold (tree expr) ...@@ -5690,8 +5690,8 @@ fold (tree expr)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type)) && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
&& TYPE_MODE (final_type) == TYPE_MODE (inter_type)) && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
&& ! final_ptr) && ! final_ptr)
return fold_convert (final_type, return fold (build1 (code, final_type,
TREE_OPERAND (TREE_OPERAND (t, 0), 0)); TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
} }
if (TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR if (TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR
......
2004-02-09 Roger Sayle <roger@eyesopen.com>
* gcc.c-torture/compile/20040209-1.c: New test case.
2004-02-08 Joseph S. Myers <jsm@polyomino.org.uk> 2004-02-08 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/c90-init-1.c: Adjust expected error messages. * gcc.dg/c90-init-1.c: Adjust expected error messages.
......
/* The following code used to ICE in fold_convert. */
float ceilf(float);
int foo(float x)
{
return (double)ceilf(x);
}
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