[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #11 from janus at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #10)
> If you were asking if the non-typebound form using interface instead is
> valid form, yes it is.

I was wondering mainly what the non-typebound form is supposed do at runtime,
as opposed to the typebound form, but I guess I have figured that out by now.

r243784 should implement what is specified in the F03 standard in section 
9.5.3.7.3 ("Resolving derived-type input/output procedure references"). I think
this issue can be closed.

[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

--- Comment #10 from Jerry DeLisle  ---
(In reply to janus from comment #4)
> Sorry, actually the example in comment 3 only ICEs if the type-binding of
> the DTIO is commented out:
> 
> module m
>   type :: t
> integer :: i     contains
> ! procedure :: wf
> ! generic :: write(formatted) => wf
>   end type
>   interface write(formatted)
> procedure wf
>   end interface

If you were asking if the non-typebound form using interface instead is valid
form, yes it is. I was looking down at the main body of your program and
wandering what should the print statement do. I have not looked yet, but I
assume it should compile a call to st_write followed by a call to
st_write_done, in the empty type case. Possibly with a call to transfer_derived
in between

[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

--- Comment #9 from janus at gcc dot gnu.org ---
Author: janus
Date: Sun Dec 18 13:22:13 2016
New Revision: 243784

URL: https://gcc.gnu.org/viewcvs?rev=243784=gcc=rev
Log:
2016-12-18  Janus Weil  

PR fortran/78848
* trans-io.c (get_dtio_proc): Generate non-typebound DTIO call for
class
variables, if no typebound DTIO procedure is available.

2016-12-18  Janus Weil  

PR fortran/78848
* gfortran.dg/dtio_22.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/dtio_22.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-io.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

--- Comment #8 from janus at gcc dot gnu.org ---
Created attachment 40361
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40361=edit
patch

The attached patch implements what I think needs to happen (and regtests
cleanly).

[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-12-18
   Assignee|unassigned at gcc dot gnu.org  |janus at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug fortran/78848] [7 Regression] [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure

2016-12-18 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

janus at gcc dot gnu.org changed:

   What|Removed |Added

Summary|[OOP] ICE on writing CLASS  |[7 Regression] [OOP] ICE on
   |variable with non-typebound |writing CLASS variable with
   |DTIO procedure  |non-typebound DTIO
   ||procedure

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #5)
> BTW, I suspect the ICE might be a regression introduced by r243609 (my fix
> for PR 78737).

Mikael's observation at https://gcc.gnu.org/ml/fortran/2016-12/msg00236.html
supports this.