diff options
author | David Malcolm <dmalcolm@redhat.com> | 2024-03-21 17:48:38 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2024-03-21 17:48:38 -0400 |
commit | 7a5a4a4467b2e18ff4fe24f565e120280d3e6ba7 (patch) | |
tree | 4f7827631fe73ae907ed0dcbf26414ebe15f6f97 /gcc/analyzer/region-model.cc | |
parent | 48d49200510198cafcab55601cd8e5f8eb541f01 (diff) | |
download | gcc-7a5a4a4467b2e18ff4fe24f565e120280d3e6ba7.zip gcc-7a5a4a4467b2e18ff4fe24f565e120280d3e6ba7.tar.gz gcc-7a5a4a4467b2e18ff4fe24f565e120280d3e6ba7.tar.bz2 |
analyzer: fix ignored constraints involving casts [PR113619]
gcc/analyzer/ChangeLog:
PR analyzer/113619
* region-model.cc (region_model::eval_condition): Fix
cast-handling from r14-3632-ge7b267444045c5 so that if those give
an unknown result, we continue trying the constraint manager.
gcc/testsuite/ChangeLog:
PR analyzer/113619
* c-c++-common/analyzer/taint-divisor-pr113619.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/region-model.cc')
-rw-r--r-- | gcc/analyzer/region-model.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index c3a4ec7..902b887 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -4704,17 +4704,27 @@ region_model::eval_condition (const svalue *lhs, if (lhs_un_op && CONVERT_EXPR_CODE_P (lhs_un_op->get_op ()) && rhs_un_op && CONVERT_EXPR_CODE_P (rhs_un_op->get_op ()) && lhs_type == rhs_type) - return eval_condition (lhs_un_op->get_arg (), - op, - rhs_un_op->get_arg ()); - + { + tristate res = eval_condition (lhs_un_op->get_arg (), + op, + rhs_un_op->get_arg ()); + if (res.is_known ()) + return res; + } else if (lhs_un_op && CONVERT_EXPR_CODE_P (lhs_un_op->get_op ()) && lhs_type == rhs_type) - return eval_condition (lhs_un_op->get_arg (), op, rhs); - + { + tristate res = eval_condition (lhs_un_op->get_arg (), op, rhs); + if (res.is_known ()) + return res; + } else if (rhs_un_op && CONVERT_EXPR_CODE_P (rhs_un_op->get_op ()) && lhs_type == rhs_type) - return eval_condition (lhs, op, rhs_un_op->get_arg ()); + { + tristate res = eval_condition (lhs, op, rhs_un_op->get_arg ()); + if (res.is_known ()) + return res; + } } /* Otherwise, try constraints. |