public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, middle-end] Fix PR 82976, non-trivial conversion at assignment
@ 2018-04-07 18:08 Thomas König
  2018-04-07 18:36 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas König @ 2018-04-07 18:08 UTC (permalink / raw)
  To: gcc-patches, fortran

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

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.

[-- Attachment #2: realloc_on_assign_16a.f90 --]
[-- Type: text/x-fortran, Size: 621 bytes --]

! { dg-do compile }
! { dg-options "-Ofast -fno-tree-forwprop" }
! Test that PR 82976 is fixed, this used to ICE.
!
! Contributed by Stefan Mauerberger  <stefan.mauerberger@gmail.com>
!
PROGRAM main
    !USE MPI

    TYPE :: test_typ
        REAL, ALLOCATABLE :: a(:)
    END TYPE

    TYPE(test_typ) :: xx, yy
    TYPE(test_typ), ALLOCATABLE :: conc(:)

    !CALL MPI_INIT(i)

    xx = test_typ( [1.0,2.0] )
    yy = test_typ( [4.0,4.9] )

    conc = [ xx, yy ]

    if (any (int (10.0*conc(1)%a) .ne. [10,20])) STOP 1
    if (any (int (10.0*conc(2)%a) .ne. [40,49])) STOP 2

    !CALL MPI_FINALIZE(i)

END PROGRAM main

[-- Attachment #3: p1.diff --]
[-- Type: text/x-patch, Size: 569 bytes --]

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, middle-end] Fix PR 82976, non-trivial conversion at assignment
  2018-04-07 18:08 [patch, middle-end] Fix PR 82976, non-trivial conversion at assignment Thomas König
@ 2018-04-07 18:36 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-04-07 18:36 UTC (permalink / raw)
  To: fortran, Thomas König, gcc-patches, fortran

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-07 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 18:08 [patch, middle-end] Fix PR 82976, non-trivial conversion at assignment Thomas König
2018-04-07 18:36 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).