aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-01-18 19:13:44 +0100
committerJakub Jelinek <jakub@redhat.com>2021-01-18 19:13:44 +0100
commit9675ccd64efe78bc4791436c34d57cd894640f39 (patch)
tree17ad2b20b99e70564ddda936ce64259643e570af /gcc/tree-ssa-math-opts.c
parentf56e14101b9f808b4cdded9bf6900b2ec4b1417a (diff)
downloadgcc-9675ccd64efe78bc4791436c34d57cd894640f39.zip
gcc-9675ccd64efe78bc4791436c34d57cd894640f39.tar.gz
gcc-9675ccd64efe78bc4791436c34d57cd894640f39.tar.bz2
widening_mul: Fix up signed multiplication overflow check handling [PR98727]
I forgot one line, which means that if the second operand of the multiplication isn't constant, it would be just the same as the first one. 2021-01-18 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/98727 * tree-ssa-math-opts.c (match_arith_overflow): Fix up computation of second .MUL_OVERFLOW operand for signed multiplication with overflow checking if the second operand of multiplication is not constant. * gcc.c-torture/execute/pr98727.c: New test.
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 5175ab5..d6201d3 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -4170,6 +4170,7 @@ match_arith_overflow (gimple_stmt_iterator *gsi, gimple *stmt,
rhs2 = fold_convert (type, rhs2);
else
{
+ g = SSA_NAME_DEF_STMT (rhs2);
if (gimple_assign_cast_p (g)
&& useless_type_conversion_p (type,
TREE_TYPE (gimple_assign_rhs1 (g)))