This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/68846] Pointer function as LValue doesn't work when the assignment regards a dummy argument.


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

--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---

Further modified and reduced to a skeleton, i.e. :


$ cat z3.f90
module m68846
   type t
   contains
      procedure, nopass :: f => f1
   end type
contains
   function f1() result(p)
      real, pointer :: p
   end
   subroutine s3(z, value)
      type(t) :: z
      real, intent(in) :: value
      z%f() = value
   end
end module


$ cat z4.f90
module m68846
   type t
   contains
      procedure, nopass :: f => f1
   end type
contains
   function f1() result(p)
      real, pointer :: p
   end
   subroutine s3(z, value)
      type(t) :: z
      real, intent(inout) :: value
      z%f() = value   !!
   end
end module


$ gfortran-7-20161204 -c z3.f90
z3.f90:13:19:

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


$ gfortran-7-20161204 -c z4.f90
z4.f90:7:0:

    function f1() result(p)

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]