[Bug middle-end/82976] [8 Regression] Error: non-trivial conversion at assignment since r254526

2018-04-08 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82976

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Thomas Koenig  ---
Fixed, closing.

[Bug middle-end/82976] [8 Regression] Error: non-trivial conversion at assignment since r254526

2018-04-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82976

--- Comment #14 from Thomas Koenig  ---
Author: tkoenig
Date: Sat Apr  7 23:52:03 2018
New Revision: 259212

URL: https://gcc.gnu.org/viewcvs?rev=259212&root=gcc&view=rev
Log:
2018-04-07  Thomas Koenig  
Andrew Pinski 

PR middle-end/82976
* match.pd: Use constant_boolean_node of correct type instead of
boolean_true_node or boolean_false_node for simplifying
pointer comparisons to zero.

2018-04-07  Thomas Koenig  

PR middle-end/82976
* gfortran.dg/realloc_on_assign_16a.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_16a.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/match.pd
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/82976] [8 Regression] Error: non-trivial conversion at assignment since r254526

2018-04-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82976

--- Comment #13 from Thomas Koenig  ---
(In reply to Andrew Pinski from comment #12)
> match.pd looks like it has a type bug:
> /* Simplify pointer equality compares using PTA.  */
> (for neeq (ne eq)
>  (simplify
>   (neeq @0 @1)
>   (if (POINTER_TYPE_P (TREE_TYPE (@0))
>&& ptrs_compare_unequal (@0, @1))
>{ neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))
> 
> 
> It assumes all types of EQ_EXPR/NE_EXPR will be boolean_type_node which is
> not true.
> It should be using constant_boolean_node (neeq != EQ_EXPR, type); .

I'll run a regression-test on

Index: match.pd
===
--- match.pd(Revision 259152)
+++ match.pd(Arbeitskopie)
@@ -3700,7 +3700,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (neeq @0 @1)
   (if (POINTER_TYPE_P (TREE_TYPE (@0))
&& ptrs_compare_unequal (@0, @1))
-   { neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))
+   { constant_boolean_node (neeq != EQ_EXPR, type); })))

 /* PR70920: Transform (intptr_t)x eq/ne CST to x eq/ne (typeof x) CST.
and (typeof ptr_cst) x eq/ne ptr_cst to x eq/ne (typeof x) CST.

and submit if it passes.

[Bug middle-end/82976] [8 Regression] Error: non-trivial conversion at assignment since r254526

2018-04-06 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82976

Andrew Pinski  changed:

   What|Removed |Added

  Component|fortran |middle-end

--- Comment #12 from Andrew Pinski  ---
match.pd looks like it has a type bug:
/* Simplify pointer equality compares using PTA.  */
(for neeq (ne eq)
 (simplify
  (neeq @0 @1)
  (if (POINTER_TYPE_P (TREE_TYPE (@0))
   && ptrs_compare_unequal (@0, @1))
   { neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))


It assumes all types of EQ_EXPR/NE_EXPR will be boolean_type_node which is not
true.
It should be using constant_boolean_node (neeq != EQ_EXPR, type); .