Re: [Patc, fortran] PR85603 - ICE with character array substring assignment

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Patc, fortran] PR85603 - ICE with character array substring assignment

Dominique d'Humières-2
Hi Paul,

I get a regression with your patch:

obfuscated_tn4.f90:300:0:

  300 |     TP6%ROR=TP6%ROR(:PP4-1)
      |
internal compiler error: in gfc_trans_deferred_vars, at fortran/trans-decl.c:4754


I’ll try to reduce the test.

Dominique

Reply | Threaded
Open this post in threaded view
|

Re: [Patc, fortran] PR85603 - ICE with character array substring assignment

Dominique d'Humières-2
Reduced test

! { dg-do compile }
MODULE TN4
  IMPLICIT NONE
  PRIVATE
  INTEGER,PARAMETER::SH4=KIND('a')
  TYPE,PUBLIC::TOP
    CHARACTER(:,KIND=SH4),ALLOCATABLE::ROR
    CHARACTER(:,KIND=SH4),ALLOCATABLE::VI8
  CONTAINS
    PROCEDURE,NON_OVERRIDABLE::SB=>TPX
  END TYPE TOP
CONTAINS
  SUBROUTINE TPX(TP6,PP4,BA3)
    CLASS(TOP),INTENT(INOUT)::TP6
    INTEGER,INTENT(IN)::PP4
    TYPE(TOP),INTENT(OUT)::BA3
    BA3%ROR=TP6%ROR(PP4:)
    BA3%VI8=TP6%ROR(PP4:)
    TP6%ROR=TP6%ROR(:PP4-1)
    TP6%VI8=TP6%ROR(:PP4-1)
  END SUBROUTINE TPX
END MODULE TN4
! https://groups.google.com/forum/#!topic/comp.lang.fortran/nV3TlRlVKBc

TIA

Dominique

> Le 19 oct. 2018 à 23:39, Dominique d'Humières <[hidden email]> a écrit :
>
> Hi Paul,
>
> I get a regression with your patch:
>
> obfuscated_tn4.f90:300:0:
>
>  300 |     TP6%ROR=TP6%ROR(:PP4-1)
>      |
> internal compiler error: in gfc_trans_deferred_vars, at fortran/trans-decl.c:4754
>
>
> I’ll try to reduce the test.
>
> Dominique
>

Reply | Threaded
Open this post in threaded view
|

Re: [Patc, fortran] PR85603 - ICE with character array substring assignment

Paul Richard Thomas
Hmmm! It helps to provide the patch.

2018-10-18  Paul Thomas  <[hidden email]>

    PR fortran/85603
    * frontend-passes.c (get_len_call): New function to generate a
    call to intrinsic LEN.
    (create_var): Use this to make length expressions for variable
    rhs string lengths.
    Clean up some white space issues.

2018-10-18  Paul Thomas  <[hidden email]>

    PR fortran/85603
    * gfortran.dg/deferred_character_23.f90 : Check reallocation is
    occurring as it should and a regression caused by version 1 of
    this patch.

On Sat, 20 Oct 2018 at 13:32, Paul Richard Thomas
<[hidden email]> wrote:

>
> Hi Dominique,
>
> Thanks for picking that up. For some reason that I do now see, the
> regression is caused by the component references. The frontend
> temporary is picking up the deferred tag from somewhere, even though
> it is not set. Anyway, all is well if the patch is restricted to
> character right hand side symbols. I have added a test for the
> regression to the testcase.
>
> OK for trunk?
>
> Paul
>
> On Fri, 19 Oct 2018 at 23:15, Dominique d'Humières <[hidden email]> wrote:
> >
> > Reduced test
> >
> > ! { dg-do compile }
> > MODULE TN4
> >   IMPLICIT NONE
> >   PRIVATE
> >   INTEGER,PARAMETER::SH4=KIND('a')
> >   TYPE,PUBLIC::TOP
> >     CHARACTER(:,KIND=SH4),ALLOCATABLE::ROR
> >     CHARACTER(:,KIND=SH4),ALLOCATABLE::VI8
> >   CONTAINS
> >     PROCEDURE,NON_OVERRIDABLE::SB=>TPX
> >   END TYPE TOP
> > CONTAINS
> >   SUBROUTINE TPX(TP6,PP4,BA3)
> >     CLASS(TOP),INTENT(INOUT)::TP6
> >     INTEGER,INTENT(IN)::PP4
> >     TYPE(TOP),INTENT(OUT)::BA3
> >     BA3%ROR=TP6%ROR(PP4:)
> >     BA3%VI8=TP6%ROR(PP4:)
> >     TP6%ROR=TP6%ROR(:PP4-1)
> >     TP6%VI8=TP6%ROR(:PP4-1)
> >   END SUBROUTINE TPX
> > END MODULE TN4
> > ! https://groups.google.com/forum/#!topic/comp.lang.fortran/nV3TlRlVKBc
> >
> > TIA
> >
> > Dominique
> >
> > > Le 19 oct. 2018 à 23:39, Dominique d'Humières <[hidden email]> a écrit :
> > >
> > > Hi Paul,
> > >
> > > I get a regression with your patch:
> > >
> > > obfuscated_tn4.f90:300:0:
> > >
> > >  300 |     TP6%ROR=TP6%ROR(:PP4-1)
> > >      |
> > > internal compiler error: in gfc_trans_deferred_vars, at fortran/trans-decl.c:4754
> > >
> > >
> > > I’ll try to reduce the test.
> > >
> > > Dominique
> > >
> >
>
>
> --
> "If you can't explain it simply, you don't understand it well enough"
> - Albert Einstein


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

resubmit.diff (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patc, fortran] PR85603 - ICE with character array substring assignment

Thomas Koenig-6
Hi Paul,

>
> 2018-10-18  Paul Thomas  <[hidden email]>
>
>      PR fortran/85603
>      * frontend-passes.c (get_len_call): New function to generate a
>      call to intrinsic LEN.
>      (create_var): Use this to make length expressions for variable
>      rhs string lengths.
>      Clean up some white space issues.
>
> 2018-10-18  Paul Thomas  <[hidden email]>
>
>      PR fortran/85603
>      * gfortran.dg/deferred_character_23.f90 : Check reallocation is
>      occurring as it should and a regression caused by version 1 of
>      this patch.

OK.

Thanks for the patch!

Regards

        Thomas