Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Comunicados
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

!dir$ attributes align issue

jimdempseyatthecove
Colaborador honorário III
1.491 Visualizações
!  Console2.f90 
module mod_foo
    integer, parameter :: n=8
    double precision :: a(n)
    !dir$ attributes align : sizeof(double precision)*n :: a
    double precision :: b(n)
    !dir$ attributes align : sizeof(b(1))*n :: b
    double precision :: c(n)
    !dir$ attributes align : 8*n :: c
end module mod_foo
    
program tst
    use mod_foo
    print *, a,b
end program
1>C:\Users\Jim\Source\Repos\Console2\Console2\Console2.f90(5): error #6326: This specifier is invalid for this I/O operation.
1>C:\Users\Jim\Source\Repos\Console2\Console2\Console2.f90(7): error #6326: This specifier is invalid for this I/O operation.
1>C:\Users\Jim\Source\Repos\Console2\Console2\Console2.f90(9): error #6326: This specifier is invalid for this I/O operation.

Jim Dempsey

0 Kudos
5 Respostas
Steve_Lionel
Colaborador honorário III
1.480 Visualizações

Weird error message, but this directive just wants an integer literal there, not an expression. "sizeof(double precision)" would be invalid almost anywhere (exception being fixed-form where you have a variable "DOUBLEPRECISION").

My guess for the message text is that the developer picked a number for an existing message and didn't think about the wording being appropriate.

jimdempseyatthecove
Colaborador honorário III
1.460 Visualizações

sizeof(double precision), sizeof(REAL), sizeof(logical), ...  should be a compile time evaluation.

In the actual code, I wanted the compiler to assure that an array of some type, is aligned at a boundary of equal to the sizeof(array) .equiv. to sizeof(type of array)*parameter of number of elements in array.

IMHO sizeof() should be available at compile time in places where identity of what is being sizeof'd can be determined at compile time.

Jim Dempsey

Steve_Lionel
Colaborador honorário III
1.454 Visualizações

Yes, SIZEOF (an extension) can be evaluated at compile time, but the syntax of directives doesn't provide for expressions or even named (PARAMETER) constants - literals only.

jimdempseyatthecove
Colaborador honorário III
1.440 Visualizações

Then this leads the solution to having to use /fpp and #define ...

Something which is frowned upon.

Jim Dempsey

andrew_4619
Colaborador honorário III
1.436 Visualizações

Given these are all non-standard constructs does it really matter which form of extension is used ie fpp or !dec$ or both.

Responder