This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] More TYPE_OVERFLOW_* fallout (PR middle-end/64292)


m68k revealed another missing check before TYPE_OVERFLOW_WRAPS.
I think we should use INTEGRAL_TYPE_P, and not ANY_INTEGRAL_TYPE_P
because the switch handles VECTOR_CST and COMPLEX_CST.

Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?

2014-12-15  Marek Polacek  <polacek@redhat.com>

	PR middle-end/64292
	* fold-const.c (negate_expr_p): Add INTEGRAL_TYPE_P check.

diff --git gcc/fold-const.c gcc/fold-const.c
index d71fa94..07da71a 100644
--- gcc/fold-const.c
+++ gcc/fold-const.c
@@ -400,7 +400,7 @@ negate_expr_p (tree t)
   switch (TREE_CODE (t))
     {
     case INTEGER_CST:
-      if (TYPE_OVERFLOW_WRAPS (type))
+      if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type))
 	return true;
 
       /* Check that -CST will not overflow type.  */

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]