From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [committed] analyzer: handle vector types (PR 93350)
Date: Mon, 10 Feb 2020 23:17:00 -0000 [thread overview]
Message-ID: <20200210231709.32370-1-dmalcolm@redhat.com> (raw)
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to master as r10-6567-ge87deb37649cfe480217fc83c8d56fe925600f93.
gcc/analyzer/ChangeLog:
PR analyzer/93350
* region-model.cc (region_model::get_lvalue_1):
Handle BIT_FIELD_REF.
(make_region_for_type): Handle VECTOR_TYPE.
gcc/testsuite/ChangeLog:
PR analyzer/93350
* gcc.dg/analyzer/torture/pr93350.c: New test.
---
gcc/analyzer/region-model.cc | 11 ++++++++++-
gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c | 11 +++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index fd82360cc6e..ae810f5eb4b 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -4662,6 +4662,14 @@ region_model::get_lvalue_1 (path_var pv, region_model_context *ctxt)
}
break;
+ case BIT_FIELD_REF:
+ {
+ /* For now, create a view, as if a cast, ignoring the bit positions. */
+ tree obj = TREE_OPERAND (expr, 0);
+ return get_or_create_view (get_lvalue (obj, ctxt), TREE_TYPE (expr));
+ };
+ break;
+
case MEM_REF:
{
tree ptr = TREE_OPERAND (expr, 0);
@@ -6035,7 +6043,8 @@ make_region_for_type (region_id parent_rid, tree type)
if (INTEGRAL_TYPE_P (type)
|| SCALAR_FLOAT_TYPE_P (type)
|| POINTER_TYPE_P (type)
- || TREE_CODE (type) == COMPLEX_TYPE)
+ || TREE_CODE (type) == COMPLEX_TYPE
+ || TREE_CODE (type) == VECTOR_TYPE)
return new primitive_region (parent_rid, type);
if (TREE_CODE (type) == RECORD_TYPE)
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c
new file mode 100644
index 00000000000..1799da1936c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c
@@ -0,0 +1,11 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-Wno-psabi" } */
+
+typedef __INT32_TYPE__ int32_t;
+typedef int32_t vnx4si __attribute__((vector_size (32)));
+
+__attribute__((noipa))
+vnx4si foo(int a, int b)
+{
+ return (vnx4si) { 1, 2, 3, 4, 5, 6, a, b };
+}
--
2.21.0
reply other threads:[~2020-02-10 23:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200210231709.32370-1-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).