http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
Summary: type bounded function can not return a pointer of a
array
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
!------------------- code -------------------------
module aa
type bb
integer,pointer,dimension(:) :: cc
integer,pointer :: dd
contains
procedure :: getcc
procedure :: getdd
end type
contains
function getcc(this) result(cc)
class(bb) :: this
integer,pointer,dimension(:) :: cc
cc => this%cc
end function
function getdd(this) result(dd)
class(bb) :: this
integer,pointer :: dd
dd => this%dd
end function
end module
program main
use aa
implicit none
type(bb) :: b1
integer,pointer,dimension(:) :: p1
integer,pointer :: p2
allocate(b1%cc(10),b1%dd)
b1%cc = 10
b1%dd = 5
p1 => b1%getcc() ! Line 34, HERE !!
write(*,*) 'p1 ',p1(1)
p2 => b1%getdd()
write(*,*) 'p2 ',p2
end
!------------------- code -------------------------
2 compile command line and info
$ gfortran -v -save-temps test_point_arg02.f95
Driving: gfortran -v -save-temps test_point_arg02.f95 -lgfortran -lm
-shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/f951 test_point_arg02.f95
-quiet -dumpbase test_point_arg02.f95 -mtune=generic -march=x86-64 -auxbase
test_point_arg02 -version -fintrinsic-modules-path
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/finclude -o
test_point_arg02.s
GNU Fortran (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test_point_arg02.f95: In function ‘MAIN__’:
test_point_arg02.f95:34:0: internal compiler error: in gfc_conv_variable, at
fortran/trans-expr.c:551
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.