[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-11-29 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

--- Comment #8 from Gerhard Steinmetz  
---

ICEs from above are fixed a while ago, not present with gfortran-7-20161127.

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

--- Comment #7 from kargl at gcc dot gnu.org ---

> $ cat zc1.f90
> module m
>type t
>contains
>   procedure :: s
>   generic :: write(unformatted) => s
>end type
> contains
>subroutine s(dtv, *)
>   class(t), intent(out) :: dtv
>end
> end
> 
> 
> $ gfortran-7-20160911 zc1.f90
> zc1.f90:8:19:
> 
> subroutine s(dtv, *)
>1
> Error: DTIO dummy argument at (1) must have intent IN
> f951: internal compiler error: Segmentation fault
> 0xc2154f crash_signal
> ../../gcc/toplev.c:336
> 0x69290d check_dtio_arg_TKR_intent
> ../../gcc/fortran/interface.c:4561
> 0x692b4a check_dtio_interface1
> ../../gcc/fortran/interface.c:4676
> 0x69a303 gfc_check_dtio_interfaces(gfc_symbol*)
> ../../gcc/fortran/interface.c:4735
> 0x70c86b do_traverse_symtree
> ../../gcc/fortran/symbol.c:3939
> 0x6f65c0 resolve_types
> ../../gcc/fortran/resolve.c:15658
> 0x6f1d9c gfc_resolve(gfc_namespace*)
> ../../gcc/fortran/resolve.c:15730
> 0x6dd3a4 gfc_parse_file()
> ../../gcc/fortran/parse.c:6056
> 0x71f5f2 gfc_be_parse_file
> ../../gcc/fortran/f95-lang.c:198
> 
troutmask:sgk[232] svn diff interface.c |more
Index: interface.c
===
--- interface.c (revision 240119)
+++ interface.c (working copy)
@@ -4558,6 +4558,9 @@ static void
 check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type,
   int kind, int rank, sym_intent intent)
 {
+  if (!fsym)
+return;
+
   if (fsym->ts.type != type)
 {
   gfc_error ("DTIO dummy argument at %L must be of type %s",
@@ -4584,7 +4587,6 @@ check_dtio_arg_TKR_intent (gfc_symbol *f
   if (fsym->attr.intent != intent)
 gfc_error ("DTIO dummy argument at %L must have intent %s",
   >declared_at, gfc_code2string (intents, (int)intent));
-  return;
 }

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #5)
> Thank you very much for working on these issues.
> Additional tests with an improved version from 20160911
> revealed a few other errors, as bespoken attached hereto :
> 
> 
> $ cat za1.f90
> module m
>type t
>end type
>interface write(formatted)
>   module procedure s
>end interface
> contains
>subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
>   class(t), intent(in) :: dtv
>   integer, intent(in) :: unit
>   character(len=*), intent(in) :: iotype
>   integer, intent(in) :: vlist(:)
>   integer, intent(out) :: iostat
>   character(len=*), intent(inout) :: iomsg
>end
> end
> 
> 
> $ cat za2.f90
> module m
>type t
>end type
>interface read(formatted)
>   module procedure s
>end interface
> contains
>subroutine s(dtv,unit,iotype,vlist,iostat,iomsg,extra)
>   class(t), intent(inout) :: dtv
>   integer, intent(in) :: unit
>   character(len=*), intent(in) :: iotype
>   integer, intent(in) :: vlist(:)
>   integer, intent(out) :: iostat
>   character(len=*), intent(inout) :: iomsg
>end
> end
> 
> 
> $ cat za3.f90
> module m
>type t
>end type
>interface read(formatted)
>   module procedure s
>end interface
> contains
>subroutine s(dtv,extra,unit,iotype,vlist,iostat,iomsg)
>   class(t), intent(inout) :: dtv
>   integer, intent(in) :: unit
>   character(len=*), intent(in) :: iotype
>   integer, intent(in) :: vlist(:)
>   integer, intent(out) :: iostat
>   character(len=*), intent(inout) :: iomsg
>end
> end
> 
> 
> $ gfortran-7-20160911 za1.f90
> za1.f90:8:43:
> 
> subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
>1
> Error: DTIO dummy argument at (1) must be of type INTEGER
> za1.f90:8:50:
> 
> subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
>   1
> Error: DTIO dummy argument at (1) must be of type CHARACTER
> f951: internal compiler error: in check_dtio_interface1, at
> fortran/interface.c:4707

troutmask:sgk[218] svn diff interface.c
Index: interface.c
===
--- interface.c (revision 240119)
+++ interface.c (working copy)
@@ -4704,7 +4704,7 @@ check_dtio_interface1 (gfc_symbol *deriv
 0, intent);
  break;
default:
- gcc_unreachable ();
+ gfc_internal_error ("check_dtio_interface1: invalid argument");
}
 }
   derived->attr.has_dtio_procs = 1;

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-13 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

Gerhard Steinmetz  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #5 from Gerhard Steinmetz  
---

Thank you very much for working on these issues.
Additional tests with an improved version from 20160911
revealed a few other errors, as bespoken attached hereto :


$ cat za1.f90
module m
   type t
   end type
   interface write(formatted)
  module procedure s
   end interface
contains
   subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
  class(t), intent(in) :: dtv
  integer, intent(in) :: unit
  character(len=*), intent(in) :: iotype
  integer, intent(in) :: vlist(:)
  integer, intent(out) :: iostat
  character(len=*), intent(inout) :: iomsg
   end
end


$ cat za2.f90
module m
   type t
   end type
   interface read(formatted)
  module procedure s
   end interface
contains
   subroutine s(dtv,unit,iotype,vlist,iostat,iomsg,extra)
  class(t), intent(inout) :: dtv
  integer, intent(in) :: unit
  character(len=*), intent(in) :: iotype
  integer, intent(in) :: vlist(:)
  integer, intent(out) :: iostat
  character(len=*), intent(inout) :: iomsg
   end
end


$ cat za3.f90
module m
   type t
   end type
   interface read(formatted)
  module procedure s
   end interface
contains
   subroutine s(dtv,extra,unit,iotype,vlist,iostat,iomsg)
  class(t), intent(inout) :: dtv
  integer, intent(in) :: unit
  character(len=*), intent(in) :: iotype
  integer, intent(in) :: vlist(:)
  integer, intent(out) :: iostat
  character(len=*), intent(inout) :: iomsg
   end
end


$ gfortran-7-20160911 za1.f90
za1.f90:8:43:

subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
   1
Error: DTIO dummy argument at (1) must be of type INTEGER
za1.f90:8:50:

subroutine s(dtv,unit,iotype,vlist,extra,iostat,iomsg)
  1
Error: DTIO dummy argument at (1) must be of type CHARACTER
f951: internal compiler error: in check_dtio_interface1, at
fortran/interface.c:4707
0x692c19 check_dtio_interface1
../../gcc/fortran/interface.c:4707
0x69a348 gfc_check_dtio_interfaces(gfc_symbol*)
../../gcc/fortran/interface.c:4747
0x70c86b do_traverse_symtree
../../gcc/fortran/symbol.c:3939
0x6f65c0 resolve_types
../../gcc/fortran/resolve.c:15658
0x6f1d9c gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:15730
0x6dd3a4 gfc_parse_file()
../../gcc/fortran/parse.c:6056
0x71f5f2 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:198


---


$ cat zb1.f90
module m
   type t
   end type
   interface write(unformatted)
  module procedure s
   end interface
contains
   subroutine s(*)
   end
end


$ gfortran-7-20160911 zb1.f90
f951: internal compiler error: Segmentation fault
0xc2154f crash_signal
../../gcc/toplev.c:336
0x692c73 check_dtio_interface1
../../gcc/fortran/interface.c:4633
0x69a348 gfc_check_dtio_interfaces(gfc_symbol*)
../../gcc/fortran/interface.c:4747
0x70c86b do_traverse_symtree
../../gcc/fortran/symbol.c:3939
0x6f65c0 resolve_types
../../gcc/fortran/resolve.c:15658
0x6f1d9c gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:15730
0x6dd3a4 gfc_parse_file()
../../gcc/fortran/parse.c:6056
0x71f5f2 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:198


---


$ cat zc1.f90
module m
   type t
   contains
  procedure :: s
  generic :: write(unformatted) => s
   end type
contains
   subroutine s(dtv, *)
  class(t), intent(out) :: dtv
   end
end


$ gfortran-7-20160911 zc1.f90
zc1.f90:8:19:

subroutine s(dtv, *)
   1
Error: DTIO dummy argument at (1) must have intent IN
f951: internal compiler error: Segmentation fault
0xc2154f crash_signal
../../gcc/toplev.c:336
0x69290d check_dtio_arg_TKR_intent
../../gcc/fortran/interface.c:4561
0x692b4a check_dtio_interface1
../../gcc/fortran/interface.c:4676
0x69a303 gfc_check_dtio_interfaces(gfc_symbol*)
../../gcc/fortran/interface.c:4735
0x70c86b do_traverse_symtree
../../gcc/fortran/symbol.c:3939
0x6f65c0 resolve_types
../../gcc/fortran/resolve.c:15658
0x6f1d9c gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:15730
0x6dd3a4 gfc_parse_file()
../../gcc/fortran/parse.c:6056
0x71f5f2 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:198


---


$ cat zd1.f90
module m
   type t
  character(len=20) :: name
  integer(4) :: age
   contains
  procedure :: pruf
  generic :: read(unformatted) => pruf
   end type
contains
   subroutine pruf 

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-11 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Paul Thomas  ---
This PR and PRs77533/4 fixed by the patch committed in comment #3.

Thanks for the report.

Paul and Jerry.

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-10 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

--- Comment #3 from Jerry DeLisle  ---
Author: jvdelisle
Date: Sat Sep 10 21:16:45 2016
New Revision: 240074

URL: https://gcc.gnu.org/viewcvs?rev=240074=gcc=rev
Log:
2016-09-10  Paul Thomas  
Steven G. Kargl  

PR fortran/77532
^ interface.c (check_dtio_arg_TKR_intent): Return after error.
(check_dtio_interface1): Remove asserts, test for NULL and return
if found.

gfortran.dg/dtio_11.f90: new test.

Added:
trunk/gcc/testsuite/gfortran.dg/dtio_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/interface.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-08 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

Paul Thomas  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas  ---
It's mine!

Paul

[Bug fortran/77532] ICE in check_dtio_interface1, at fortran/interface.c:4622

2016-09-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77532

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-08
 CC||pault at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed on trunk (7.0), not implemented before.