aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-09-15 13:47:42 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2023-09-15 13:47:42 -0400
commit6319b5b2d4669077e4ddf1e249eeb5602394693c (patch)
tree5a9122bb148c7bb4b3bbbe416e635e797cb314b6 /gcc/analyzer
parent1cbf18978aa384bd0ed2dc29b107fc3423cf8e62 (diff)
downloadgcc-6319b5b2d4669077e4ddf1e249eeb5602394693c.zip
gcc-6319b5b2d4669077e4ddf1e249eeb5602394693c.tar.gz
gcc-6319b5b2d4669077e4ddf1e249eeb5602394693c.tar.bz2
analyzer: handle volatile ops
gcc/analyzer/ChangeLog: * region-model.cc (region_model::get_gassign_result): Handle volatile ops by using a conjured_svalue. gcc/testsuite/ChangeLog: * c-c++-common/analyzer/volatile-1.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer')
-rw-r--r--gcc/analyzer/region-model.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 2e774c2..c4e68661 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -729,6 +729,17 @@ region_model::get_gassign_result (const gassign *assign,
region_model_context *ctxt)
{
tree lhs = gimple_assign_lhs (assign);
+
+ if (gimple_has_volatile_ops (assign)
+ && !gimple_clobber_p (assign))
+ {
+ conjured_purge p (this, ctxt);
+ return m_mgr->get_or_create_conjured_svalue (TREE_TYPE (lhs),
+ assign,
+ get_lvalue (lhs, ctxt),
+ p);
+ }
+
tree rhs1 = gimple_assign_rhs1 (assign);
enum tree_code op = gimple_assign_rhs_code (assign);
switch (op)