Commit 376da68e by Kaveh R. Ghazi Committed by Kaveh Ghazi

builtins.c (fold_builtin_cabs): Use validate_arg().

	* builtins.c (fold_builtin_cabs): Use validate_arg().
	(fold_builtin_cexp): Fix if-logic.
	(fold_builtin_1): Check subtype for BUILT_IN_CIMAG.

From-SVN: r153488
parent d5b5b6bc
2009-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (fold_builtin_cabs): Use validate_arg().
(fold_builtin_cexp): Fix if-logic.
(fold_builtin_1): Check subtype for BUILT_IN_CIMAG.
2009-10-22 Jeff Law <law@redhat.com> 2009-10-22 Jeff Law <law@redhat.com>
* ira-lives.c (process_single_reg_class_operands): Update the * ira-lives.c (process_single_reg_class_operands): Update the
...@@ -7194,7 +7194,7 @@ fold_builtin_cabs (location_t loc, tree arg, tree type, tree fndecl) ...@@ -7194,7 +7194,7 @@ fold_builtin_cabs (location_t loc, tree arg, tree type, tree fndecl)
{ {
tree res; tree res;
if (TREE_CODE (TREE_TYPE (arg)) != COMPLEX_TYPE if (!validate_arg (arg, COMPLEX_TYPE)
|| TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) != REAL_TYPE) || TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) != REAL_TYPE)
return NULL_TREE; return NULL_TREE;
...@@ -7583,7 +7583,7 @@ fold_builtin_cexp (location_t loc, tree arg0, tree type) ...@@ -7583,7 +7583,7 @@ fold_builtin_cexp (location_t loc, tree arg0, tree type)
#endif #endif
if (!validate_arg (arg0, COMPLEX_TYPE) if (!validate_arg (arg0, COMPLEX_TYPE)
&& TREE_CODE (TREE_TYPE (TREE_TYPE (arg0))) == REAL_TYPE) || TREE_CODE (TREE_TYPE (TREE_TYPE (arg0))) != REAL_TYPE)
return NULL_TREE; return NULL_TREE;
#ifdef HAVE_mpc #ifdef HAVE_mpc
...@@ -10017,7 +10017,8 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore) ...@@ -10017,7 +10017,8 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore)
break; break;
CASE_FLT_FN (BUILT_IN_CIMAG): CASE_FLT_FN (BUILT_IN_CIMAG):
if (validate_arg (arg0, COMPLEX_TYPE)) if (validate_arg (arg0, COMPLEX_TYPE)
&& TREE_CODE (TREE_TYPE (TREE_TYPE (arg0))) == REAL_TYPE)
return non_lvalue_loc (loc, fold_build1_loc (loc, IMAGPART_EXPR, type, arg0)); return non_lvalue_loc (loc, fold_build1_loc (loc, IMAGPART_EXPR, type, arg0));
break; break;
......
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