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

ifort rejects nested array constructor despite typespec

Harald1
Novice
306 Views

Intel 2021.5.0 rejects the following code - which is accepted by NAG:

program p
  integer, parameter :: a(*) = [1]
  print *, [ real :: + a  ] ! OK
  print *, [ real :: +[a] ] ! rejected
  print *, [ real :: +[1] ] ! rejected
end

 The compiler gives:

ifort-nested-ctor.f90(4): error #8209: If type specification is omitted, each element in an
array-constructor must have the same type and kind type parameters.
 print *, [ real :: +[a] ] ! rejected
---------------------^
ifort-nested-ctor.f90(5): error #8209: If type specification is omitted, each element in an
array-constructor must have the same type and kind type parameters.
 print *, [ real :: +[1] ] ! rejected
---------------------^
compilation aborted for ifort-nested-ctor.f90 (code 1)

Somehow the unary + sign in front of the constructor confuses the compiler.

 

Thanks,

Harald

0 Kudos
1 Solution
Barbara_P_Intel
Moderator
274 Views

Thank for reporting this with such a small reproducer. We appreciate that!

I filed a bug report, CMPLRIL0-34589. I'll let you know its progress to a fix.



View solution in original post

3 Replies
Barbara_P_Intel
Moderator
275 Views

Thank for reporting this with such a small reproducer. We appreciate that!

I filed a bug report, CMPLRIL0-34589. I'll let you know its progress to a fix.



Barbara_P_Intel
Moderator
103 Views

This issue with the erroneous error message is fixed in ifx 2023.0.0 and ifort 2021.8.0 that were released in December as part of the oneAPI HPC Toolkit. Please check it out!

 

Harald1
Novice
78 Views

Yes, it is indeed fixed.  Thanks!

 

Reply