[middle-end] Fix PR 82976, non-trivial conversion at assignment
diff mbox series

Message ID 0656c90b-7cdb-40a1-87af-7c44bea642d1@tkoenig.net
State New
Headers show
Series
  • [middle-end] Fix PR 82976, non-trivial conversion at assignment
Related show

Commit Message

Thomas König April 7, 2018, 6:08 p.m. UTC
Hello world,

the attached patch fixes a middle-end bug, which caused a Fortran
regression.  The solution was given by Andrew on IRC and
in the PR, I did the testing.

Regression-tested with "configure --enable-languages=all" and
"make -k check" on x86_64-pc-linux-gnu.

OK for trunk?

Regards

	Thomas

2018-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
         Andrew Pinski <pinsika@gcc.gnu.org>

         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  <tkoenig@gcc.gnu.org>

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

Comments

Richard Biener April 7, 2018, 6:36 p.m. UTC | #1
On April 7, 2018 8:08:39 PM GMT+02:00, "Thomas König" <tk@tkoenig.net> wrote:
>Hello world,
>
>the attached patch fixes a middle-end bug, which caused a Fortran
>regression.  The solution was given by Andrew on IRC and
>in the PR, I did the testing.
>
>Regression-tested with "configure --enable-languages=all" and
>"make -k check" on x86_64-pc-linux-gnu.
>
>OK for trunk?

OK. 

Richard. 

>Regards
>
>	Thomas
>
>2018-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
>         Andrew Pinski <pinsika@gcc.gnu.org>
>
>         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  <tkoenig@gcc.gnu.org>
>
>         PR middle-end/82976
>         * gfortran.dg/realloc_on_assign_16a.f90: New test.

Patch
diff mbox series

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.