- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider:
type foo_t
double precision :: array(8) ! cache line size
end type foo_t
...
type(foo_t) :: foo(3,3)
...
call fefe(foo)
...
subroutine fefe(fi)
type(foo_t) :: fi(3,3)
...
While I can declare foo to be aligned, I can not instruct the compiler to know that fi(i,j)%array is aligned.
I think that in this case this should be permissible as sizeof(foo_t) is known.
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Doesn't the ASSUME_ALIGNED directive do what you want? Or am I misunderstanding the question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler complains about having a member variable of an array of user defined type being aligned (even when size of UDT is multiple of alignment). Unfortunately I cannot get the error message now as I cannot Remote Desktop into the development system with the "offending" code.
I do not have the exact text of the error/warning message on this system but it was something to the effect that compiler could not know the alignment of a non-allocatable or non-pointer member of a member variable of an array of user defined types. Presumably should the array of UDT be aligned .AND. .NOT. of sizeof multiple of alignment, then the 2nd (and later) elements of UDT array might not also be aligned as is the base of the array of UDT. In this specific case, the size of the UDT element ought to be known by the compiler, and thus for this case the assume_aligned ought to be permitted.
I will see if I can get the actual circumstance messaged when I can re-connect to the development system.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW note that this applies to the called subroutine and not where the the (aligned) UDT is defined.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page