View previous topic :: View next topic |
Author |
Message |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Wed Nov 15, 2017 10:58 am Post subject: |
|
|
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 |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Wed Nov 15, 2017 11:30 am Post subject: |
|
|
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 |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Wed Nov 15, 2017 11:46 am Post subject: |
|
|
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 |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Thu Dec 21, 2017 5:03 pm Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Dec 21, 2017 9:26 pm Post subject: |
|
|
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 |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Thu Dec 21, 2017 9:41 pm Post subject: Re: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Fri Dec 22, 2017 8:44 am Post subject: |
|
|
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 |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Fri Dec 22, 2017 10:22 am Post subject: |
|
|
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 |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Fri Dec 22, 2017 11:07 am Post subject: Re: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Fri Dec 22, 2017 4:13 pm Post subject: |
|
|
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 |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Fri Dec 22, 2017 4:18 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Fri Dec 22, 2017 4:48 pm Post subject: |
|
|
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 |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Sun Dec 24, 2017 12:03 am Post subject: |
|
|
... 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 |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Tue Dec 26, 2017 3:55 am Post subject: |
|
|
... 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 |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Tue Dec 26, 2017 10:45 am Post subject: |
|
|
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 |
|
|
|