* [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars
@ 2016-06-11 19:26 Paul Richard Thomas
2016-06-12 15:21 ` Thomas Koenig
0 siblings, 1 reply; 4+ messages in thread
From: Paul Richard Thomas @ 2016-06-11 19:26 UTC (permalink / raw)
To: fortran, gcc-patches; +Cc: D Kinniburgh
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
Dear All,
The fix to eliminate this ICE is trivial.
Bootstrapped and regtested on FC21/x86_64 - OK for 5 to 7 branches?
Cheers
Paul
2016-06-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/70673
* frontend-passes.c (realloc_string_callback): Add a call to
gfc_dep_compare_expr.
2016-06-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/70673
* gfortran.dg/pr70673.f90: New test.
[-- Attachment #2: submit.diff --]
[-- Type: text/plain, Size: 1744 bytes --]
Index: gcc/fortran/frontend-passes.c
===================================================================
*** gcc/fortran/frontend-passes.c (revision 237168)
--- gcc/fortran/frontend-passes.c (working copy)
*************** realloc_string_callback (gfc_code **c, i
*** 175,180 ****
--- 175,187 ----
if (!gfc_check_dependency (expr1, expr2, true))
return 0;
+ /* gfc_check_dependency doesn't always pick up identical expressions.
+ However, eliminating the above sends the compiler into an infinite
+ loop on valid expressions. Without this check, the gimplifier emits
+ an ICE for a = a, where a is deferred character length. */
+ if (!gfc_dep_compare_expr (expr1, expr2))
+ return 0;
+
current_code = c;
inserted_block = NULL;
changed_statement = NULL;
Index: gcc/testsuite/gfortran.dg/pr70673.f90
===================================================================
*** gcc/testsuite/gfortran.dg/pr70673.f90 (revision 0)
--- gcc/testsuite/gfortran.dg/pr70673.f90 (working copy)
***************
*** 0 ****
--- 1,25 ----
+ ! { dg-do run }
+ !
+ ! Test the fix for PR70673
+ !
+ ! Contributed by David Kinniburgh <davidgkinniburgh@yahoo.co.uk>
+ !
+ module m
+ contains
+ subroutine s(inp)
+ character(*), intent(in) :: inp
+ character(:), allocatable :: a
+ a = a ! This used to ICE.
+ a = inp
+ a = a ! This used to ICE too
+ if ((len (a) .ne. 5) .or. (a .ne. "hello")) call abort
+ a = a(2:3) ! Make sure that temporary creation is not broken.
+ if ((len (a) .ne. 2) .or. (a .ne. "el")) call abort
+ deallocate (a)
+ a = a ! This would ICE too.
+ end subroutine s
+ end module m
+
+ use m
+ call s("hello")
+ end
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars
2016-06-11 19:26 [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars Paul Richard Thomas
@ 2016-06-12 15:21 ` Thomas Koenig
2016-06-12 17:06 ` Paul Richard Thomas
2016-06-13 7:50 ` Paul Richard Thomas
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Koenig @ 2016-06-12 15:21 UTC (permalink / raw)
To: Paul Richard Thomas, fortran, gcc-patches; +Cc: D Kinniburgh
Hi Paul,
> The fix to eliminate this ICE is trivial.
Trivial once you have found it, not so trivial before...
> Bootstrapped and regtested on FC21/x86_64 - OK for 5 to 7 branches?
OK.
Thanks a lot for the patch!
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars
2016-06-12 15:21 ` Thomas Koenig
@ 2016-06-12 17:06 ` Paul Richard Thomas
2016-06-13 7:50 ` Paul Richard Thomas
1 sibling, 0 replies; 4+ messages in thread
From: Paul Richard Thomas @ 2016-06-12 17:06 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches, D Kinniburgh
Hi Thomas,
Thanks a lot! I had meant to address the message to you explicitly
but, apparently, I forgot.
I'll start committing tonight.
Cheers
Paul
On 12 June 2016 at 17:21, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Paul,
>
>> The fix to eliminate this ICE is trivial.
>
>
> Trivial once you have found it, not so trivial before...
>
>> Bootstrapped and regtested on FC21/x86_64 - OK for 5 to 7 branches?
>
>
> OK.
>
> Thanks a lot for the patch!
>
> Thomas
--
The difference between genius and stupidity is; genius has its limits.
Albert Einstein
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars
2016-06-12 15:21 ` Thomas Koenig
2016-06-12 17:06 ` Paul Richard Thomas
@ 2016-06-13 7:50 ` Paul Richard Thomas
1 sibling, 0 replies; 4+ messages in thread
From: Paul Richard Thomas @ 2016-06-13 7:50 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches, D Kinniburgh
Dear All,
Committed to trunk as revision 237358.
5- and 6- branches to follow towards the end of the week.
Cheers
Paul
On 12 June 2016 at 17:21, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Paul,
>
>> The fix to eliminate this ICE is trivial.
>
>
> Trivial once you have found it, not so trivial before...
>
>> Bootstrapped and regtested on FC21/x86_64 - OK for 5 to 7 branches?
>
>
> OK.
>
> Thanks a lot for the patch!
>
> Thomas
--
The difference between genius and stupidity is; genius has its limits.
Albert Einstein
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-13 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-11 19:26 [Patch, fotran] PR70673 - [5/6/7 Regression] ICE with module containing functions with allocatable character scalars Paul Richard Thomas
2016-06-12 15:21 ` Thomas Koenig
2016-06-12 17:06 ` Paul Richard Thomas
2016-06-13 7:50 ` Paul Richard Thomas
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).