public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2690] analyzer: avoid usage of TYPE_PRECISION on vector types [PR110455]
@ 2023-07-21  0:29 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2023-07-21  0:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a4913a19d24a794c97f38d9c65c47c1fb9f2140c

commit r14-2690-ga4913a19d24a794c97f38d9c65c47c1fb9f2140c
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Jul 20 20:24:10 2023 -0400

    analyzer: avoid usage of TYPE_PRECISION on vector types [PR110455]
    
    gcc/analyzer/ChangeLog:
            PR analyzer/110455
            * region-model.cc (region_model::get_gassign_result): Only check
            for bad shift counts when dealing with an integral type.
    
    gcc/testsuite/ChangeLog:
            PR analyzer/110455
            * gcc.dg/analyzer/pr110455.c: New test.
    
    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

Diff:
---
 gcc/analyzer/region-model.cc             | 3 ++-
 gcc/testsuite/gcc.dg/analyzer/pr110455.c | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 187013a37cc..e01b1c88299 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -860,7 +860,8 @@ region_model::get_gassign_result (const gassign *assign,
 	       or by greater than or equal to the number of bits that exist in
 	       the operand."  */
 	    if (const tree rhs2_cst = rhs2_sval->maybe_get_constant ())
-	      if (TREE_CODE (rhs2_cst) == INTEGER_CST)
+	      if (TREE_CODE (rhs2_cst) == INTEGER_CST
+		  && INTEGRAL_TYPE_P (TREE_TYPE (rhs1)))
 		{
 		  if (tree_int_cst_sgn (rhs2_cst) < 0)
 		    ctxt->warn
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr110455.c b/gcc/testsuite/gcc.dg/analyzer/pr110455.c
new file mode 100644
index 00000000000..7f979436b79
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr110455.c
@@ -0,0 +1,7 @@
+int __attribute__((__vector_size__ (4))) v;
+
+void
+foo (void)
+{
+  v | v << 1;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-21  0:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21  0:29 [gcc r14-2690] analyzer: avoid usage of TYPE_PRECISION on vector types [PR110455] David Malcolm

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).