public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96294] New: Compile error for pointer function
@ 2020-07-23  7:42 peng.wang@compiler-dev.com
  2020-07-23 10:45 ` [Bug fortran/96294] " dominiq at lps dot ens.fr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: peng.wang@compiler-dev.com @ 2020-07-23  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96294
           Summary: Compile error for pointer function
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peng.wang@compiler-dev.com
  Target Milestone: ---

I got a testcase like this:

****
program a
        IMPLICIT NONE
        myfunc() = 311
        print*,myfunc()

contains
    FUNCTION myfunc() RESULT (result_ptr)
        IMPLICIT NONE
        INTEGER, POINTER :: result_ptr
        INTEGER, SAVE, TARGET:: targ

        result_ptr => targ
    END FUNCTION myfunc
end program a
****

But I got a compile error for the testcase above:
****
func-04.f90:7:4:

    7 |     FUNCTION myfunc() RESULT (result_ptr)
      |    1
Error: INTERNAL-PROC procedure at (1) is already declared as STATEMENT-PROC
procedure.
F2008: A pointer function assignment is ambiguous if it is the first executable
statement after the specification block. Please add any other kind of
executable statement before it. FIXME
func-04.f90:7:4:

    7 |     FUNCTION myfunc() RESULT (result_ptr)
      |    1
Error: Statement function ‘myfunc’ at (1) may not have pointer or allocatable
attribute
func-04.f90:3:19:

    3 |         myfunc() = 311
      |                   1
Error: Pointer assignment target cannot be a constant at (1)
****

I wonder if this pointer function feature is not support by gfortran ,or if it
is a bug above?

this is the options given when GCC was configured:
# gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-pc-linux-gnu/10.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc -enable-checking=release
-enable-languages=c,fortran -disable-bootstrap -disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (GCC)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-23 12:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  7:42 [Bug fortran/96294] New: Compile error for pointer function peng.wang@compiler-dev.com
2020-07-23 10:45 ` [Bug fortran/96294] " dominiq at lps dot ens.fr
2020-07-23 11:36 ` peng.wang@compiler-dev.com
2020-07-23 12:18 ` dominiq at lps dot ens.fr
2020-07-23 12:51 ` peng.wang@compiler-dev.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).