diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2009-10-23 05:28:25 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2009-10-23 05:28:25 +0000 |
commit | 376da68ead38d584131fcba1cd33cea896a6136e (patch) | |
tree | 2911de4c19dedd70bcd79acc922cbf6120fa258e /gcc/builtins.c | |
parent | d5b5b6bca0e7126a75715c2478a62dd4b5ed8808 (diff) | |
download | gcc-376da68ead38d584131fcba1cd33cea896a6136e.zip gcc-376da68ead38d584131fcba1cd33cea896a6136e.tar.gz gcc-376da68ead38d584131fcba1cd33cea896a6136e.tar.bz2 |
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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index d991408..1243d72 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7194,7 +7194,7 @@ fold_builtin_cabs (location_t loc, tree arg, tree type, tree fndecl) { 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) return NULL_TREE; @@ -7583,7 +7583,7 @@ fold_builtin_cexp (location_t loc, tree arg0, tree type) #endif 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; #ifdef HAVE_mpc @@ -10017,7 +10017,8 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore) break; 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)); break; |