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 

8.20 and /Zeroize
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5275
Location: Salford, UK

PostPosted: Wed Nov 15, 2017 10:58 am    Post subject: Reply with quote

Eddie

In order to provide an answer I would write a short test program and look at the output and the assembly list provided by /explist. To test if COMMON variables are preset set to zero I would just print them out without setting a value. Not fool-proof but a fairly safe test. Reading the assembly instructions is not easy but it is quicker than referring to the FTN95 source code.

Let me know how you get on.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1771
Location: Yateley, Hants, UK

PostPosted: Wed Nov 15, 2017 11:30 am    Post subject: Reply with quote

Paul,

Yes, it does seem to initialised named and blank COMMON:

Code:
      PROGRAM TEST_COMMON
      COMMON / NAMED / A, B(2), I, J(2)
      COMMON Q, R(2)
      WRITE(*,*) A, B, I, J
      WRITE(*,*) Q, R
      END


as appropriate 0.000 and 0 values are output.

Now to look at the other issue.

Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1771
Location: Yateley, Hants, UK

PostPosted: Wed Nov 15, 2017 11:46 am    Post subject: Reply with quote

And again, it looks like one loop

Code:
mov       eax,0.0
mov       ecx,Z'0019a280'
lea         edi,C
rep       
stos


in:

Code:
      PROGRAM TEST_INIT
      DIMENSION C(100, 120, 140)
      C = 0.0
      END


Which looks to me like a good and efficient result (the hex value is the product of the 3 dimensions). Of course a warning is generated because C isn't used.

(32 bit only tried).

Eddie
Back to top
View user's profile Send private message
KennyT



Joined: 02 Aug 2005
Posts: 274

PostPosted: Thu Dec 21, 2017 5:03 pm    Post subject: Reply with quote

Despite all the above comments, are there still plans to implement /Zeroise for 64-bit usage?

Our application is "built on old sand" and trying to do a 64-bit release of it without /zero would give me "anal jitters"!!!

K
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 751

PostPosted: Thu Dec 21, 2017 9:26 pm    Post subject: Reply with quote

Kenny, read Paul's initial reply (first comment on p.1).

It appears thqat /ZEROISE is effectively the default and included automatically for 64-bit compiler.

I guess it's just a question of you running your application and seeing what happens to start with !!!
Back to top
View user's profile Send private message
KennyT



Joined: 02 Aug 2005
Posts: 274

PostPosted: Thu Dec 21, 2017 9:41 pm    Post subject: Re: Reply with quote

John-Silver wrote:
Kenny, read Paul's initial reply (first comment on p.1).

It appears thqat /ZEROISE is effectively the default and included automatically for 64-bit compiler.

I guess it's just a question of you running your application and seeing what happens to start with !!!

hmmm,

unless i've completely misunderstood...

Paul said it's not implemented for the 64-bit compiler...yet...

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5275
Location: Salford, UK

PostPosted: Fri Dec 22, 2017 8:44 am    Post subject: Reply with quote

Kenny

My understanding remains as follows...

1) /ZEROISE was incorrectly documented. What you expect to get with /ZEROISE, you get anyway.

2) /ZEROISE only has an impact when used with /UNDEF (for Win32 and .NET).

3) /ZEROISE (for use with /UNDEF) has not yet been implemented for x64.
Back to top
View user's profile Send private message
KennyT



Joined: 02 Aug 2005
Posts: 274

PostPosted: Fri Dec 22, 2017 10:22 am    Post subject: Reply with quote

ok, so, just for clarification..

Code:
program test
    write(*,*) 'i=',i
end



under 8.2/64 reports an undefined variable.

but

Code:
program test
call test1
end

subroutine test1
    write(*,*) 'i=',i
end



reports 0.

One thing i notice is that under 8.20/64 a console application is generated but under 8.1/32, a white window is created with the result. is there a switch for this (i'd prefer the white window method).

both compilation scripts have "/windows" specified.

K
Back to top
View user's profile Send private message Visit poster's website
KennyT



Joined: 02 Aug 2005
Posts: 274

PostPosted: Fri Dec 22, 2017 11:07 am    Post subject: Re: Reply with quote

KennyT wrote:

One thing i notice is that under 8.20/64 a console application is generated but under 8.1/32, a white window is created with the result. is there a switch for this (i'd prefer the white window method).

both compilation scripts have "/windows" specified.

K

ok, i found the windows SLINK64 command (RTFM!), although i note that it's not reported by SLINK64/help as being there as an option.

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5275
Location: Salford, UK

PostPosted: Fri Dec 22, 2017 4:13 pm    Post subject: Reply with quote

Kenny

The whole concept relates primarily to variables that are given the SAVE attribute. As Eddie has noted, this extends to the COMMON BLOCK. So your tests should use SAVE either in the code or on the FTN95 command line.
Back to top
View user's profile Send private message
KennyT



Joined: 02 Aug 2005
Posts: 274

PostPosted: Fri Dec 22, 2017 4:18 pm    Post subject: Reply with quote

so why did 'I' get set to zero in the subroutine, when there wasn't a SAVE statement?

not that i'm complaining, just interested!

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5275
Location: Salford, UK

PostPosted: Fri Dec 22, 2017 4:48 pm    Post subject: Reply with quote

I could work through the compilation etc. to get a definitive answer but the short answer is that it could be a random zero or maybe not. The important thing is to know is when you can be confident that a variable is preset to zero.

My personal recommendation would be to avoid all dependence on "zeroise", to test using /UNDEF and make sure when testing that all routes through the code are traversed.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 751

PostPosted: Sun Dec 24, 2017 12:03 am    Post subject: Reply with quote

... or put another way, nything which worked ok before should work in the same way now since FTN95 autonažmaticaly 0's everything, even in x64 ? .... so Kenny should have no problems ... maybe
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1928
Location: Sydney

PostPosted: Tue Dec 26, 2017 3:55 am    Post subject: Reply with quote

... or put another way, not initialising all variables is bad coding practice and not portable.

Sorry to be a grouch, but I never assume zero for uninitialized variables.
If I have not initialised a variable then it is a mistake that needs fixing.

If you have an accumulator that is not initialised, what do you expect to happen the second time you use the routine ?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1771
Location: Yateley, Hants, UK

PostPosted: Tue Dec 26, 2017 10:45 am    Post subject: Reply with quote

I agree with John C here, and for me (for quite a long time) the need was to find the quickest and best way to initialise large blocks of data.It seems to be extremely fast now. Assuming things start out as being zeroed will eventually come back and bite you.

Eddie
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 -> General All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
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