diff mbox

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

Message ID 20141215113353.GB16332@redhat.com
State New
Headers show

Commit Message

Marek Polacek Dec. 15, 2014, 11:33 a.m. UTC
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.


	Marek

Comments

Richard Biener Dec. 15, 2014, 12:04 p.m. UTC | #1
On Mon, 15 Dec 2014, Marek Polacek wrote:

> 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?

Ok.

Thanks,
Richard.

> 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
> 
>
diff mbox

Patch

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.  */