[Bug fortran/93427] New: Rejects valid with pointer result from recursive function
abensonca at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jan 25 05:10:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93427
Bug ID: 93427
Summary: Rejects valid with pointer result from recursive
function
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: abensonca at gmail dot com
Target Milestone: ---
The following code fails to compile (using git commit
472dc648ce3e7661762931d584d239611ddca964):
module a
type :: t
end type t
contains
recursive function b()
class(t), pointer :: b
type(t) :: c
allocate(t :: b)
select type (b)
type is (t)
b=c
end select
end function b
end module a
$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-git/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.1 20200124 (experimental) (GCC)
$ gfortran -c p.F90 -o p.o
p.F90:12:15:
12 | select type (b)
| 1
Error: Associating entity 'b' at (1) is a procedure name
p.F90:14:5:
14 | b=c
| 1
Error: 'b' at (1) associated to vector-indexed target cannot be used in a
variable definition context (assignment)
The code compiles successfully using ifort 18.0.1. Removing the "recursive"
attribute, or specifying a "result()" variable makes the errors go away.
More information about the Gcc-bugs
mailing list