* [PATCH] PR fortran/91296 -- Prevent ICE in aliasing check
@ 2019-07-30 16:59 Steve Kargl
2019-07-30 18:53 ` Thomas Koenig
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2019-07-30 16:59 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
The attach patch has been regression tested on x86_64-*-freebsd.
There were no regression.
The patch prevents an ICE when checking for aliasing and the
actual arguments are the real and imaginary parts of a complex
entity. See the testcase for more information.
OK to commit to both trunk and 9-branch?
2019-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91296
* interface.c (compare_actual_expr): When checking for aliasing, add
a case to handle REF_INQUIRY (e.g., foo(x%re, x%i) do not alias).
2019-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91296
* gfortran.dg/pr91296.f90: New test.
--
Steve
[-- Attachment #2: pr91296.diff --]
[-- Type: text/x-diff, Size: 1404 bytes --]
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (revision 273846)
+++ gcc/fortran/interface.c (working copy)
@@ -3489,6 +3489,13 @@ compare_actual_expr (gfc_expr *e1, gfc_expr *e2)
case REF_SUBSTRING:
return false;
+ case REF_INQUIRY:
+ if (e1->symtree->n.sym->ts.type == BT_COMPLEX
+ && e1->ts.type == BT_REAL && e2->ts.type == BT_REAL
+ && r1->u.i != r2->u.i)
+ return false;
+ break;
+
default:
gfc_internal_error ("compare_actual_expr(): Bad component code");
}
Index: gcc/testsuite/gfortran.dg/pr91296.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr91296.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr91296.f90 (working copy)
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options "-Waliasing" }
+! PR fortran/91296
+! Code contributed by Chinoune Mehdi <chinoune dot medhi at hotmail dot com>
+module m
+ implicit none
+ integer, parameter :: sp = selected_real_kind(6)
+
+contains
+ pure subroutine s(a,b,c)
+ real(sp), intent(in) :: a, b
+ real(sp), intent(out) :: c
+ c = a + b
+ end subroutine s
+end module m
+
+program test
+ use m
+ implicit none
+ real(sp) :: a
+ complex(sp) :: c
+
+ c = (1._sp,1._sp)
+ call s(c%re,c%im,a) ! *** This use to cause an ICE. ***
+ print*,a
+
+end program test
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PR fortran/91296 -- Prevent ICE in aliasing check
2019-07-30 16:59 [PATCH] PR fortran/91296 -- Prevent ICE in aliasing check Steve Kargl
@ 2019-07-30 18:53 ` Thomas Koenig
2019-07-30 20:51 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2019-07-30 18:53 UTC (permalink / raw)
To: sgk, fortran, gcc-patches
Hi Steve,
> The attach patch has been regression tested on x86_64-*-freebsd.
> There were no regression.
>
> The patch prevents an ICE when checking for aliasing and the
> actual arguments are the real and imaginary parts of a complex
> entity. See the testcase for more information.
>
> OK to commit to both trunk and 9-branch?
OK.
Thanks for the patch!
Regards
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PR fortran/91296 -- Prevent ICE in aliasing check
2019-07-30 18:53 ` Thomas Koenig
@ 2019-07-30 20:51 ` Steve Kargl
0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2019-07-30 20:51 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches
On Tue, Jul 30, 2019 at 08:17:39PM +0200, Thomas Koenig wrote:
> Hi Steve,
>
> > The attach patch has been regression tested on x86_64-*-freebsd.
> > There were no regression.
> >
> > The patch prevents an ICE when checking for aliasing and the
> > actual arguments are the real and imaginary parts of a complex
> > entity. See the testcase for more information.
> >
> > OK to commit to both trunk and 9-branch?
>
> OK.
>
> Thanks for the patch!
>
Thanks for quick reviewed. Committed to trunk as
revision 273914.
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-30 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 16:59 [PATCH] PR fortran/91296 -- Prevent ICE in aliasing check Steve Kargl
2019-07-30 18:53 ` Thomas Koenig
2019-07-30 20:51 ` Steve Kargl
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).