public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] Remove workaround introduced because of PR80945
@ 2018-02-18 16:18 Thomas Koenig
  2018-02-19 12:33 ` Paul Richard Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2018-02-18 16:18 UTC (permalink / raw)
  To: fortran, gcc-patches

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

Hello world,

after Paul's fix for PR80945, the code in frontend-passes.c meant
to circumvent this bug is no longer needed. The attached patch
removes it, adding a test case which shows that the optimization
is working.

After this, I think we can finally lay PR 35339 to rest.

Regression-tested. OK for trunk?

Regards

	Thomas

2018-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/35339
         * frontend-passes.c (traverse_io_block): Remove workaround for
         PR 80945.

2018-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/35339
         * gfortran.dg/implied_do_io_4.f90: New test.

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

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 257788)
+++ frontend-passes.c	(Arbeitskopie)
@@ -1162,14 +1162,7 @@ traverse_io_block (gfc_code *code, bool *has_reach
 
   gcc_assert (curr->op == EXEC_TRANSFER);
 
-  /* FIXME: Workaround for PR 80945 - array slices with deferred character
-     lenghts do not work.  Remove this section when the PR is fixed.  */
   e = curr->expr1;
-  if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER
-      && e->ts.deferred)
-    return false;
-  /* End of section to be removed.  */
-
   ref = e->ref;
   if (!ref || ref->type != REF_ARRAY || ref->u.ar.codimen != 0 || ref->next)
     return false;

[-- Attachment #3: implied_do_io_4.f90 --]
[-- Type: text/x-fortran, Size: 774 bytes --]

! { dg-do  run }
! { dg-additional-options "-ffrontend-optimize -fdump-tree-original" }
! PR fortran/35339  - make sure that I/O of an implied DO loop
! of allocatable character arrays a) works and b) is converted
! to a transfer_array
program main
    implicit none
    integer:: i
    integer, parameter:: N = 10
    character(len=:), dimension(:),allocatable:: ca
    allocate(character(len=N):: ca(3))
    open(unit=10,status="scratch")
    ca(1) = "foo"
    ca(2) = "bar"
    ca(3) = "xyzzy"
    write (10, '(3A10)') (ca(i),i=1,3)
    rewind (10)
    ca(:) = ''
    read (10, '(3A10)') (ca(i),i=1,3)
    if (ca(1) /= 'foo' .or. ca(2) /= 'bar' .or. ca(3) /= 'xyzzy') call abort
end program
! { dg-final { scan-tree-dump-times "_gfortran_transfer_array" 2 "original" } }

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

* Re: [patch, fortran] Remove workaround introduced because of PR80945
  2018-02-18 16:18 [patch, fortran] Remove workaround introduced because of PR80945 Thomas Koenig
@ 2018-02-19 12:33 ` Paul Richard Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2018-02-19 12:33 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: fortran, gcc-patches

Hi Thomas,

I have tested this with the new version of the patch for PR83344 - it
is OK for trunk.

Thanks

Paul


On 18 February 2018 at 16:17, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> after Paul's fix for PR80945, the code in frontend-passes.c meant
> to circumvent this bug is no longer needed. The attached patch
> removes it, adding a test case which shows that the optimization
> is working.
>
> After this, I think we can finally lay PR 35339 to rest.
>
> Regression-tested. OK for trunk?
>
> Regards
>
>         Thomas
>
> 2018-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>
>
>         PR fortran/35339
>         * frontend-passes.c (traverse_io_block): Remove workaround for
>         PR 80945.
>
> 2018-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>
>
>         PR fortran/35339
>         * gfortran.dg/implied_do_io_4.f90: New test.



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein

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

end of thread, other threads:[~2018-02-19 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-18 16:18 [patch, fortran] Remove workaround introduced because of PR80945 Thomas Koenig
2018-02-19 12:33 ` 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).