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

reshape not working

killjoy
Beginner
681 Views
I've been trying to resize a vector into a two dimensional array but at compile time I keep getting the same error message

Here is the program and the output

program prog2
integer::b(6)
b=(/ 1,2,3,4,5,6 /)
RESHAPE (b, (/2, 3/))
print 10, b
10 format (3(2X, I3))
end program prog2

# ifc -w reshape.f90 -o reshape
program PROG2

RESHAPE (b, (/2, 3/))
^
Error 395 at (4:reshape.f90) : This entity is not an array and must not be subscripted

1 Error
0 Kudos
2 Replies
Steven_L_Intel1
Employee
681 Views
RESHAPE is a function, not a statement. The message is a bit obscure, but then again, the compiler was quite perplexed as to what you wanted.

CVF's message is essentially a syntax error...

You need to assign the result of RESHAPE to something, or use it in some context that requires an array.

Steve
0 Kudos
killjoy
Beginner
681 Views
Thanks Steve, I'll figure out my bum from my head one of these days
0 Kudos
Reply