Skip to content

Commit

Permalink
2013-12-14 Janus Weil <[email protected]>
Browse files Browse the repository at this point in the history
	PR fortran/59450
	* module.c (mio_expr): Handle type-bound function expressions.


2013-12-14  Janus Weil  <[email protected]>

	PR fortran/59450
	* gfortran.dg/typebound_proc_31.f90: New.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205983 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
janus committed Dec 14, 2013
1 parent 959e44a commit c55d169
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 8 deletions.
5 changes: 5 additions & 0 deletions gcc/fortran/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2013-12-14 Janus Weil <[email protected]>

PR fortran/59450
* module.c (mio_expr): Handle type-bound function expressions.

2013-12-12 Tobias Burnus <[email protected]>

PR fortran/59440
Expand Down
33 changes: 25 additions & 8 deletions gcc/fortran/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -3358,12 +3358,24 @@ mio_expr (gfc_expr **ep)
{
e->value.function.name
= mio_allocated_string (e->value.function.name);
flag = e->value.function.esym != NULL;
mio_integer (&flag);
if (flag)
mio_symbol_ref (&e->value.function.esym);
if (e->value.function.esym)
flag = 1;
else if (e->ref)
flag = 2;
else
write_atom (ATOM_STRING, e->value.function.isym->name);
flag = 0;
mio_integer (&flag);
switch (flag)
{
case 1:
mio_symbol_ref (&e->value.function.esym);
break;
case 2:
mio_ref_list (&e->ref);
break;
default:
write_atom (ATOM_STRING, e->value.function.isym->name);
}
}
else
{
Expand All @@ -3372,10 +3384,15 @@ mio_expr (gfc_expr **ep)
free (atom_string);

mio_integer (&flag);
if (flag)
mio_symbol_ref (&e->value.function.esym);
else
switch (flag)
{
case 1:
mio_symbol_ref (&e->value.function.esym);
break;
case 2:
mio_ref_list (&e->ref);
break;
default:
require_atom (ATOM_STRING);
e->value.function.isym = gfc_find_function (atom_string);
free (atom_string);
Expand Down
5 changes: 5 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2013-12-14 Janus Weil <[email protected]>

PR fortran/59450
* gfortran.dg/typebound_proc_31.f90: New.

2013-12-13 Rainer Orth <[email protected]>

* g++.dg/cilk-plus/cilk-plus.exp: Properly set ld_library_path.
Expand Down
28 changes: 28 additions & 0 deletions gcc/testsuite/gfortran.dg/typebound_proc_31.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! { dg-do compile }
!
! PR 59450: [OOP] ICE for type-bound-procedure expression in module procedure interface
!
! Contributed by <[email protected]>

module classes

implicit none

type :: base_class
contains
procedure, nopass :: get_num
end type

contains

pure integer function get_num()
end function

function get_array( this ) result(array)
class(base_class), intent(in) :: this
integer, dimension( this%get_num() ) :: array
end function

end module

! { dg-final { cleanup-modules "classes" } }

0 comments on commit c55d169

Please sign in to comment.