public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tree_nonzero_bits vs vector and complex types
@ 2022-11-02 21:46 apinski
  2022-11-02 21:46 ` [PATCH 1/2] Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector types apinski
  2022-11-02 21:46 ` [PATCH 2/2] Add assert for type on tree_nonzero_bits apinski
  0 siblings, 2 replies; 6+ messages in thread
From: apinski @ 2022-11-02 21:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

From: Andrew Pinski <apinski@marvell.com>


While looking at older unconfirmed bug reports, I noticed there was
an ubsan found issue and noticed tree_nonzero_bits was being called with
a vector type. How ubsan found it was at the end of tree_nonzero_bits,
did "return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t)));" and
it was with a vector of 1 elements which meant precision was 0
as precision stores the log2 of the number of elements in a vector.

Anyways we want to catch these kind of errors of calling tree_nonzero_bits
with a vector or a complex type. And fix the places where it is called.

Thanks,
Andrew Pinski


Andrew Pinski (2):
  Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector
    types
  Add assert for type on tree_nonzero_bits

 gcc/fold-const.cc                             |  3 +++
 gcc/match.pd                                  | 25 +++++++++++--------
 .../gcc.c-torture/compile/vector-shift-1.c    |  8 ++++++
 3 files changed, 25 insertions(+), 11 deletions(-)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-shift-1.c

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-20 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 21:46 [PATCH 0/2] tree_nonzero_bits vs vector and complex types apinski
2022-11-02 21:46 ` [PATCH 1/2] Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector types apinski
2022-11-05 11:44   ` Richard Biener
2022-12-20 13:45     ` Richard Biener
2022-11-02 21:46 ` [PATCH 2/2] Add assert for type on tree_nonzero_bits apinski
2022-11-05 11:47   ` Richard Biener

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