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

ifort/ifx bug with allocation of logical array

hkvzjal
New Contributor I
569 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
550 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
518 Views

 

 

Presumably

 

nmask = .not. mask

 

still works???!!!

0 Kudos
andrew_4619
Honored Contributor II
500 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
484 Views

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

Ron_Green
Moderator
474 Views

bug ID is CMPLRLLVM-54326


Reply