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/63921] New: [F08] pointer function as lvalue doesn't work when the function is a type bound function


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

            Bug ID: 63921
           Summary: [F08] pointer function as lvalue doesn't work when the
                    function is a type bound function
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mirco.valentini at polimi dot it

Created attachment 34006
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34006&action=edit
Source code useful to explain the bug

If I try to use a type bounded function as lvalue 
the compiler throw this error

!...COMPILER
VERSION............................................................
Using built-in specs.
COLLECT_GCC=/opt/gcc/5.0/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc/5.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --prefix /opt/gcc/5.0/
Thread model: posix
gcc version 4.9.2 (GCC) 
!...............................................................................

!...COMPILER
OUTPUT.............................................................
lvalue.f90:110.2:

  STENCIL%JMP( 1, 1 ) = 10.0d0 + STENCIL%JMP( 1, 1 )
  1
Error: 'lvalue_jmp' in variable definition context (assignment) at (1) is not a
variable
make: *** [test.x] Error 1
!...............................................................................

!...COMPILING
COMMAND...........................................................
gfortran -save-temps lvalue.f90 -o test.x
!...............................................................................


If I want to modify the data pointed by the function I need to use a temporary
variable.

!... BUG ......................................................................
  ...
  !...Running version with temporary pointer
  !real_tmp_ptr => STENCIL%JMP( 1, 1 )
  !real_tmp_ptr = 10.0d0 + STENCIL%JMP( 1, 1 )

  !...Not running version
  STENCIL%JMP( 1, 1 ) = 10.0d0 + STENCIL%JMP( 1, 1 )
  ...
!..............................................................................

Mirco


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