Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28334 Discussions

ifort/ifx bug with allocation of logical array

hkvzjal
New Contributor I
419 Views

Hi,

I found a small bug with both ifort and ifx compilers when trying to allocate a logical array by negating on a source array. Here a minimal reproducer:

logical, allocatable :: mask(:), nmask(:)
allocate( mask(5) , source = .false. )
allocate( nmask(5), source = .not.mask(:))
end

This prompts:

error #5082: Syntax error, found '.' when expecting one of: ( <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> <INTEGER_CONSTANT> ...
allocate( nmask(5), source = .not.mask(:))

Thanks,

0 Kudos
5 Replies
andrew_4619
Honored Contributor II
400 Views

And this compiles OK so I would agree  there has to be a problem here. The new front end needs a tweak...

allocate( nmask(5), source = ( .not.mask(:) ) )
FortranFan
Honored Contributor II
368 Views

 

 

Presumably

 

nmask = .not. mask

 

still works???!!!

0 Kudos
andrew_4619
Honored Contributor II
350 Views

Yes indeed that work ok I will note that  these variants give different errors. It is just not parsing the .not. correctly 

allocate( nmask(5), source = .not.mask(:)) ! error #5082
allocate( nmask(5), source = .not.mask) ! errors #6764 and #8155

 

Ron_Green
Moderator
334 Views

This is an interesting case.  I am opening a bug report.  Thanks for finding this.

Ron_Green
Moderator
324 Views

bug ID is CMPLRLLVM-54326


Reply