https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68846

--- Comment #3 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---

Both variants reduced and simplified a bit :


$ cat z1.f90
module m68846
  type grid_t
    real, pointer :: p(:) => null()
  end type
  type subgrid_t
    class(grid_t), pointer :: grd => null()
  contains
    procedure, pass :: jmp => lvalue_jmp
  end type
contains
  function lvalue_jmp(hobj, i) result(p)
    class(subgrid_t), intent(inout) :: hobj
    integer, intent(in) :: i
    real, pointer :: p
    p => hobj%grd%p(i)
  end
  subroutine fillgeom_03(subgrid, value)
    type(subgrid_t), intent(inout) :: subgrid
    real, intent(in) :: value
    subgrid%jmp(1) = value
  end
end module


$ cat z2.f90
module m68846
  type grid_t
    real, pointer :: p(:) => null()
  end type
  type subgrid_t
    class(grid_t), pointer :: grd => null()
  contains
    procedure, pass :: jmp => lvalue_jmp
  end type
contains
  function lvalue_jmp(hobj, i) result(p)
    class(subgrid_t), intent(inout) :: hobj
    integer, intent(in) :: i
    real, pointer :: p
    p => hobj%grd%p(i)
  end
  subroutine fillgeom_03(subgrid, value)
    type(subgrid_t), intent(inout) :: subgrid
    real, intent(inout) :: value   !!
    subgrid%jmp(1) = value
  end
end module


$ gfortran-7-20161204 -c z1.f90
z1.f90:20:26:

     subgrid%jmp(1) = value
                          1
Error: Dummy argument '_F.DA0' with INTENT(IN) in pointer association context
(pointer assignment) at (1)


$ gfortran-7-20161204 -c z2.f90
z2.f90:22:0:

 end module

internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1477
0x75a352 gfc_get_symbol_decl(gfc_symbol*)
        ../../gcc/fortran/trans-decl.c:1477
0x75e5b7 generate_local_decl
        ../../gcc/fortran/trans-decl.c:5327
0x71825b do_traverse_symtree
        ../../gcc/fortran/symbol.c:3994
0x75f412 generate_local_vars
        ../../gcc/fortran/trans-decl.c:5527
0x75f412 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6206
0x7331f9 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.c:2164
0x6e72fd translate_all_program_units
        ../../gcc/fortran/parse.c:6025
0x6e72fd gfc_parse_file()
        ../../gcc/fortran/parse.c:6238
0x72b182 gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:202

Reply via email to