Quantcast
Viewing all articles
Browse latest Browse all 2746

SPREAD and UNPACK not accepted in constant expressions

Hello all,

it appears that SPREAD and UNPACK are still not accepted in constant expressions:

program ifort_unpack
implicit none
integer, parameter :: set(5) = (/ 11,12,13,14,15 /)
integer, parameter :: sel(2) = (/ 12,14 /)
logical, parameter :: mask(size(set)) = &
any (spread (set,2,size(sel)) == &
spread (sel,1,size(set)), dim=2)
integer :: i
integer, parameter :: idx(size(set)) = &
unpack (vector = (/ (i,i=1,size(set)) /), &
mask = mask, &
field = 0 )
print *, idx
end program ifort_unpack

% ifort -V ifort-unpack.f90
Intel(R) Fortran Compiler XE for applications running on IA-32, Version 13.0.1.117 Build 20121010
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Intel(R) Fortran 13.0-2074
ifort-unpack.f90(6): error #6263: This intrinsic function is invalid in constant expressions. [SPREAD]
any (spread (set,2,size(sel)) == &
------------^
ifort-unpack.f90(7): error #6263: This intrinsic function is invalid in constant expressions. [SPREAD]
spread (sel,1,size(set)), dim=2)
------------^
ifort-unpack.f90(10): error #6263: This intrinsic function is invalid in constant expressions. [UNPACK]
unpack (vector = (/ (i,i=1,size(set)) /), &
-------^
compilation aborted for ifort-unpack.f90 (code 1)

I could not find any corresponding restriction in the F2k3 and F2k8 draft, so I assume
that there should be none. (If I remember correctly, it was illegal for SPREAD in F95)

Harald


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>