aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-03-25 09:16:18 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-03-25 09:16:18 +0100
commitd53c73e02c3907858fcb41a86906b71501e91397 (patch)
tree52f7e9e36958d35ece2b7c5b688dbba401ba8db8 /gcc/gimplify.c
parentbbee5b1b4ae0ddd91b911c35141983e135cf3f0b (diff)
downloadgcc-d53c73e02c3907858fcb41a86906b71501e91397.zip
gcc-d53c73e02c3907858fcb41a86906b71501e91397.tar.gz
gcc-d53c73e02c3907858fcb41a86906b71501e91397.tar.bz2
re PR c/43385 (glibc regex testsuite failures)
PR c/43385 * gimplify.c (gimple_boolify): Only recurse on __builtin_expect argument if the argument is truth_value_p. * gcc.c-torture/execute/pr43385.c: New test. From-SVN: r157721
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f87b5b5..26906b0 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2727,7 +2727,8 @@ gimple_boolify (tree expr)
tree call = TREE_OPERAND (expr, 0);
tree fn = get_callee_fndecl (call);
- /* For __builtin_expect ((long) (x), y) recurse into x as well. */
+ /* For __builtin_expect ((long) (x), y) recurse into x as well
+ if x is truth_value_p. */
if (fn
&& DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fn) == BUILT_IN_EXPECT
@@ -2739,9 +2740,12 @@ gimple_boolify (tree expr)
if (TREE_CODE (arg) == NOP_EXPR
&& TREE_TYPE (arg) == TREE_TYPE (call))
arg = TREE_OPERAND (arg, 0);
- arg = gimple_boolify (arg);
- CALL_EXPR_ARG (call, 0)
- = fold_convert_loc (loc, TREE_TYPE (call), arg);
+ if (truth_value_p (TREE_CODE (arg)))
+ {
+ arg = gimple_boolify (arg);
+ CALL_EXPR_ARG (call, 0)
+ = fold_convert_loc (loc, TREE_TYPE (call), arg);
+ }
}
}
}