forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ALIGN attribute is not working

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
davidb



Joined: 17 Jul 2009
Posts: 557
Location: UK

PostPosted: Fri May 18, 2012 10:06 pm    Post subject: ALIGN attribute is not working Reply with quote

In the code below, the real*4 array A should be aligned on 16 byte (128 bit) address boundarys.

Unfortunately it doesn't seem to work. Sad

Code:

program anon
real, align(128) :: a(12)
integer :: addr
a = 0.0
addr = loc(a(1))
if (mod(addr,16) == 0) then
   print *,'Array is aligned on 128 bit boundary''s. It worked!'
else
   print *,'Oops, it didn''t work'
end if
end

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2154
Location: Sydney

PostPosted: Mon May 21, 2012 9:32 am    Post subject: Reply with quote

David,

This might provide more info, but does not appear to work.
Code:
program anon
real, align(128) :: a(12)
real, align(64)  :: b(12)
integer :: addr_A, addr_B
!
a = 0.0
b = 0.0
addr_A = loc(a(1))
addr_B = loc(b(1))
   write (*,*) 'A align = ',addr_A, mod (addr_A,32)
   write (*,*) 'B align = ',addr_B, mod (addr_B,32)
!
if (mod(addr_A,16) == 0) then
   print *,'Array is aligned on 128 bit boundary''s. It worked!', addr_A
else
   print *,'Oops, it didn''t work' , addr_A
end if
!
end

John
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2154
Location: Sydney

PostPosted: Mon May 28, 2012 6:24 am    Post subject: Reply with quote

Paul,

I tested my above code example and :
It worked for FTN95 Ver 6.10 using salflibc.dll Version 13.3.23.20, on XP_64,
but failed for FTN95 Ver 6.10 using salflibc.dll Version 13.12.2.9, on Win7_64

The compiler crashed with small changes to the code when I first tried to change David's code to introduce align(64). The error results from the following change.
Code:
program anon
real, align(128) :: a(12)
real, align(64)  :: b(12)
integer :: addr_A, addr_B
!
!a = 0.0
!b = 0.0
addr_A = loc(a(1))
addr_B = loc(b(1))
   write (*,*) 'A align = ',addr_A, mod (addr_A,32)
   write (*,*) 'B align = ',loc(b), mod (loc(b),32)
!
if (mod(addr_A,16) == 0) then
   print *,'Array is aligned on 128 bit boundary''s. It worked!', addr_A
else
   print *,'Oops, it didn''t work' , addr_A
end if
!
end
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group