- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following code may be using SIZE in a weird way to compute the shape and size of an array but should be valid Fortran:
program p
implicit none
integer :: k
integer, parameter :: x(2,3) = 1
integer, parameter :: s(*) = [shape(x)]
integer, parameter :: t(*) = [(size(x, dim=k), k=1,2)] ! fail
integer, parameter :: u(*) = [(size(x, dim=k), k=1,rank(x))] ! fail
integer, parameter :: v = product(shape(x))
integer, parameter :: w = product([(size(x, dim=k), k=1,2)]) ! fail
print *, s
print *, [(size(x, dim=k), k=1,rank(x))]
print *, product([(size(x, dim=k), k=1,rank(x))])
end
With current ifort/ifx I get:
% ifort ifort-size-simplify.f90
ifort-size-simplify.f90(6): error #7747: Invalid parameter expression.
integer, parameter :: t(*) = [(size(x, dim=k), k=1,2)] ! fail
---------------------------------^
ifort-size-simplify.f90(7): error #7747: Invalid parameter expression.
integer, parameter :: u(*) = [(size(x, dim=k), k=1,rank(x))] ! fail
---------------------------------^
ifort-size-simplify.f90(9): error #6063: An INTEGER or REAL data type is required in this context. [K]
integer, parameter :: w = product([(size(x, dim=k), k=1,2)]) ! fail
--------------------------------------------------^
compilation aborted for ifort-size-simplify.f90 (code 1)
Commenting the marked code lines allows the code to compile and work as expected. It is only the simplification of the array constructors needed for the constant expressions above that fails.
Thanks,
Harald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This reproducer is indeed legal Fortran. I filed a bug report, CMPLRLLVM-48095. I'll let you know when a fix is available.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This reproducer is indeed legal Fortran. I filed a bug report, CMPLRLLVM-48095. I'll let you know when a fix is available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Harald1, no more faulty error messages with ifx or ifort with the releases that were published this week. Please check them out!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wow, the ICE is gone, and I get a correct result at runtime....
Thanks!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page