public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2043] Fix tree_simple_nonnegative_warnv_p for VECTOR_TYPEs
@ 2023-06-23  9:24 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-06-23  9:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4f2fcf21d4c939831c299cb884cbeaca1d33fa8e

commit r14-2043-g4f2fcf21d4c939831c299cb884cbeaca1d33fa8e
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jun 23 10:12:24 2023 +0200

    Fix tree_simple_nonnegative_warnv_p for VECTOR_TYPEs
    
    tree_simple_nonnegative_warnv_p ends up being called on VECTOR_TYPEs
    which I think even gets the wrong answer here for tcc_comparison
    since vector bools are signed.  The following properly guards
    that with !VECTOR_TYPE_P.
    
            * fold-const.cc (tree_simple_nonnegative_warnv_p): Guard
            the truth_value_p case with !VECTOR_TYPE_P.

Diff:
---
 gcc/fold-const.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index b05b3ae16e9..ac90a594fcc 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -14530,7 +14530,8 @@ tree_expr_maybe_real_minus_zero_p (const_tree x)
 static bool
 tree_simple_nonnegative_warnv_p (enum tree_code code, tree type)
 {
-  if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
+  if (!VECTOR_TYPE_P (type)
+      && (TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
       && truth_value_p (code))
     /* Truth values evaluate to 0 or 1, which is nonnegative unless we
        have a signed:1 type (where the value is -1 and 0).  */

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

only message in thread, other threads:[~2023-06-23  9:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23  9:24 [gcc r14-2043] Fix tree_simple_nonnegative_warnv_p for VECTOR_TYPEs 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).