From c36c567c59336e3b611c2961864f567995f98051 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Mon, 9 Jul 2018 12:44:19 +0000 Subject: [PATCH] Fix overflow handling in sparc.c:sparc_fold_builtin * config/sparc/sparc.c (sparc_fold_builtin) : Adapt for signature change of wi::neg, wi::add. From-SVN: r262518 --- gcc/ChangeLog | 6 ++++++ gcc/config/sparc/sparc.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e4ecd4cdd27..1b78c69a987 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-09 Rainer Orth + + * config/sparc/sparc.c (sparc_fold_builtin) : Adapt for signature change of wi::neg, + wi::add. + 2018-07-09 Jakub Jelinek PR c/86420 diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index d90a260785c..a9a02afa7dc 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -11854,16 +11854,19 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree e0 = VECTOR_CST_ELT (arg0, i); tree e1 = VECTOR_CST_ELT (arg1, i); - bool neg1_ovf, neg2_ovf, add1_ovf, add2_ovf; + wi::overflow_type neg1_ovf, neg2_ovf, add1_ovf, add2_ovf; tmp = wi::neg (wi::to_widest (e1), &neg1_ovf); tmp = wi::add (wi::to_widest (e0), tmp, SIGNED, &add1_ovf); if (wi::neg_p (tmp)) tmp = wi::neg (tmp, &neg2_ovf); else - neg2_ovf = false; + neg2_ovf = wi::OVF_NONE; result = wi::add (result, tmp, SIGNED, &add2_ovf); - overflow |= neg1_ovf | neg2_ovf | add1_ovf | add2_ovf; + overflow |= ((neg1_ovf != wi::OVF_NONE) + | (neg2_ovf != wi::OVF_NONE) + | (add1_ovf != wi::OVF_NONE) + | (add2_ovf != wi::OVF_NONE)); } gcc_assert (!overflow); -- 2.30.2