public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] analyzer: fix ICE on vector comparisons [PR96713]
@ 2020-08-28 15:57 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-08-28 15:57 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2f5951bd95e334d611f4be7bbe1a136c580f9c20
commit 2f5951bd95e334d611f4be7bbe1a136c580f9c20
Author: David Malcolm <dmalcolm@redhat.com>
Date: Wed Aug 19 17:36:53 2020 -0400
analyzer: fix ICE on vector comparisons [PR96713]
gcc/analyzer/ChangeLog:
PR analyzer/96713
* region-model.cc (region_model::get_gassign_result): For
comparisons, only use eval_condition when the lhs has boolean
type, and use get_or_create_constant_svalue on the boolean
constants directly rather than via get_rvalue.
gcc/testsuite/ChangeLog:
PR analyzer/96713
* gcc.dg/analyzer/pr96713.c: New test.
Diff:
---
gcc/analyzer/region-model.cc | 25 ++++++++++++-------------
gcc/testsuite/gcc.dg/analyzer/pr96713.c | 8 ++++++++
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 8a5e74ebc0e..b8a0f9ffd3d 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -462,24 +462,23 @@ region_model::get_gassign_result (const gassign *assign,
{
tree rhs2 = gimple_assign_rhs2 (assign);
- // TODO: constraints between svalues
const svalue *rhs1_sval = get_rvalue (rhs1, ctxt);
const svalue *rhs2_sval = get_rvalue (rhs2, ctxt);
- tristate t = eval_condition (rhs1_sval, op, rhs2_sval);
- if (t.is_known ())
- return get_rvalue (t.is_true ()
- ? boolean_true_node
- : boolean_false_node,
- ctxt);
- else
+ if (TREE_TYPE (lhs) == boolean_type_node)
{
- // TODO: symbolic value for binop
- const svalue *sval_binop
- = m_mgr->get_or_create_binop (TREE_TYPE (lhs), op,
- rhs1_sval, rhs2_sval);
- return sval_binop;
+ /* Consider constraints between svalues. */
+ tristate t = eval_condition (rhs1_sval, op, rhs2_sval);
+ if (t.is_known ())
+ return m_mgr->get_or_create_constant_svalue
+ (t.is_true () ? boolean_true_node : boolean_false_node);
}
+
+ /* Otherwise, generate a symbolic binary op. */
+ const svalue *sval_binop
+ = m_mgr->get_or_create_binop (TREE_TYPE (lhs), op,
+ rhs1_sval, rhs2_sval);
+ return sval_binop;
}
break;
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96713.c b/gcc/testsuite/gcc.dg/analyzer/pr96713.c
new file mode 100644
index 00000000000..fe9cafd73f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96713.c
@@ -0,0 +1,8 @@
+typedef int __attribute__ ((vector_size (8))) V;
+
+void
+foo (V d, V e)
+{
+ d <= e;
+ foo ((V){}, (V){});
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-28 15:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 15:57 [gcc/devel/c++-modules] analyzer: fix ICE on vector comparisons [PR96713] Nathan Sidwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).