aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-04-13 21:52:58 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-13 21:52:58 +0200
commit099560172fc6d46fcd7878043acab799d4fb044f (patch)
tree1df8de837fda91f9d1aeedcb2cca29b6d8d39d26 /gcc/fold-const.c
parentbc0423960365b4fc8caebdd5047ea4f993df6e9a (diff)
downloadgcc-099560172fc6d46fcd7878043acab799d4fb044f.zip
gcc-099560172fc6d46fcd7878043acab799d4fb044f.tar.gz
gcc-099560172fc6d46fcd7878043acab799d4fb044f.tar.bz2
re PR sanitizer/80403 (UBSAN: compile time crash with "type mismatch in binary expression" message in / and % expr)
PR sanitizer/80403 * fold-const.c (fold_ternary_loc): Revert use op0 instead of fold_convert_loc (loc, type, arg0) part of 2017-04-12 change. * g++.dg/ubsan/pr80403-2.C: New test. From-SVN: r246917
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fb0b1a6..7701622 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -11544,7 +11544,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& (code == VEC_COND_EXPR || !VECTOR_TYPE_P (type)))
return fold_build2_loc (loc, code == VEC_COND_EXPR ? BIT_AND_EXPR
: TRUTH_ANDIF_EXPR,
- type, op0, op1);
+ type, fold_convert_loc (loc, type, arg0), op1);
/* Convert A ? B : 1 into !A || B if A and B are truth values. */
if (code == VEC_COND_EXPR ? integer_all_onesp (op2) : integer_onep (op2)