http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56765
Bug #: 56765
Summary: compilation errors/ICE with unlimited polymorphic
array
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
When compiling following program:
program t_unlimited_2
implicit none
class(*), dimension(:), pointer :: u
u => sub()
contains
function sub() result(r)
class(*), dimension(:), pointer :: r
integer, dimension(3), target :: x = [1,2,3]
r => x
end function
end program
I get the output:
----------------------------------------------------------
$gfortran -Wall -Wextra t_unlimited_2.f90
t_unlimited_2.f90:4.4:
u => sub()
1
Error: Different ranks in pointer assignment at (1)
---------------------------------------------------------
u and sub are both of rank 1.
When compiling the following (u is scalar here):
program t_unlimited_3
implicit none
class(*), pointer :: u
u => sub()
contains
function sub() result(r)
class(*), dimension(:), pointer :: r
integer, dimension(3), target :: x = [1,2,3]
r => x
end function
end program
I get an ICE:
------------------------------------------------------------
$gfortran -Wall -Wextra t_unlimited_3.f90
t_unlimited_3.f90: In function ‘t_unlimited_3’:
t_unlimited_3.f90:4:0: internal compiler error: in fold_convert_loc, at
fold-const.c:1862
u => sub()
^
t_unlimited_3.f90:4:0: internal compiler error: Abort trap
gfortran: internal compiler error: Abort trap (program f951)
Abort trap
-------------------------------------------------------------
Version:
$gfortran -v
Using built-in specs.
COLLECT_GCC=/xsw/gf48/bin/gfortran
COLLECT_LTO_WRAPPER=/xsw/gcc-4.8-20130321/install/libexec/gcc/x86_64-apple-darwin10.8.0/4.8.0/lto-wrapper
Target: x86_64-apple-darwin10.8.0
Configured with: ../src/configure --prefix=/xsw/gcc-4.8-20130321/install
--enable-languages=c,fortran --with-gmp=/opt/local --with-mpfr=/opt/local
--with-mpc=/opt/local --with-libiconv-prefix=/opt/local
Thread model: posix
gcc version 4.8.0 20130321 (prerelease) (GCC)
Running on Mac OS X 10.6.8