Hi all,

the attached patch fixes an OOP-related 4.7-only regression. Pretty
much straightforward, for details see PR.

Regtested on x86_64-unknown-linux-gnu. Ok for 4.7?

Cheers,
Janus



2014-02-02  Janus Weil  <ja...@gcc.gnu.org>

    PR fortran/59941
    * expr.c (replace_comp): Check for isym to avoid ICE.

2014-02-02  Janus Weil  <ja...@gcc.gnu.org>

    PR fortran/59941
    * gfortran.dg/typebound_proc_26.f90: New.
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 207395)
+++ gcc/fortran/expr.c  (working copy)
@@ -4195,7 +4195,7 @@ replace_comp (gfc_expr *expr, gfc_symbol *sym, int
   gfc_component *comp;
   comp = (gfc_component *)sym;
   if ((expr->expr_type == EXPR_VARIABLE 
-       || (expr->expr_type == EXPR_FUNCTION
+       || (expr->expr_type == EXPR_FUNCTION && !expr->value.function.isym
           && !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where)))
       && expr->symtree->n.sym->ns == comp->ts.interface->formal_ns)
     {
! { dg-do compile }
!
! PR 59941: [4.7 Regression] [OOP] ICE with polymorphic types
!
! Contributed by Jürgen Reuter <juergen.reu...@desy.de>

module tao_random_numbers
  integer, dimension(10), private :: s_buffer
  integer, private :: s_buffer_end = size (s_buffer)
end module


module beam_structures

  private

  type :: beam_structure_t
     integer, dimension(:), allocatable :: smatrix
   contains
     procedure :: get_smatrix
  end type
  
contains

  function get_smatrix (beam_structure) result (matrix)
    class(beam_structure_t), intent(in) :: beam_structure
    integer, dimension (size (beam_structure%smatrix)) :: matrix
  end function
  
end module


program p
  use tao_random_numbers
  use beam_structures
end

! { dg-final { cleanup-modules "tao_random_numbers beam_structures" } }

Reply via email to