I was looking at the post placed this week by INTEL on automatic variables. I did a google search on automatic variables, just to read a bit of background.
I got the following search return from google,
But when I click on the link I get a generic introduction page for Intel Software.
Intel has been deleting a lot of older pages, redirecting them back to the generic Intel Software page. Because this doesn't result in a 404 (page not found), search engines think the link is still valid. I'm incredibly annoyed that many of the still-valid articles I wrote for IDZ have been quietly deleted, eliminating this "institutional knowledge". I have the FAQ page I wrote (not linked anymore from this forum, but still there), and at least a third of the links are now dead, so I can no longer refer people to them.
AUTOMATIC as a keyword is an ancient extension and is now obsolete. In ancient days, all variables were statically allocated, and until Fortran 90, that was a valid implementation choice. Some compilers added the AUTOMATIC keyword to request stack allocation of a variable. Intel Fortran at some point changed so that scalars were allocated on the stack by default, but arrays were still static. You could override this in various ways.
If a procedure was RECURSIVE, then all variables were, effectively, automatic. Fortran 2018 specifies that procedures are RECURSIVE by default (you can now say NON_RECURSIVE if you want), so AUTOMATIC no longer does anything (unless NON_RECURSIVE). Your array was not "set" to anything - you got whatever happened to be in those memory locations.
Thanks for the long explanation.
I have found that all the integer variables that I look at, at first creation, come in at -85993940, it is amusing, when you forget to zero out array at the start. I have not checked them all, but on this machine it appears to be a common number. It is a rather random binary number.
IFORT the same thing appears to happen with some reals, but with a different number.
Re automatic, is this why in the latest Intel Fortran manual, the words on automatic are colored green?
I am loath to turn on the autoset to zero.
This is a random draw from my current program at the start of the subroutine before I initialize the variables. Sometimes they are not the noted value, particularly with arrays, but by golly gosh there are a lot of them. This is not random left over garbage, it has to be coming from the compiler?
num = -858993460
Reveals that the number is CCCCCCCC in hexadecimal. So probably a deliberate choice, perhaps to make it easy to spot in a hex dump.
Interesting, but we still don't know where it's being set. I have some vague memory of some compiler or OS that would initialize memory
to the hex pattern that spelled out BADFOOD in a hex dump.
It is uninitialized stack content. The values may have been set by some part of program start, but there is nothing the compiler does to set these values. They are unpredictable.
The words are green because AUTOMATIC is a non-standard extension. You should explicitly initialize any variables before use. Do not rely on the compiler to do it.
Thank you for the notes, I enjoyed the read first thing in the morning.
MS in the old Fortran manual used blue for non-standard extensions. I wonder who decided the change was required to green as the current Intel manual is definitely based on the old MS manual. I have a copy on my desk.
I have learnt from the kind people here to always use implicit none, and to initialize variables, to use BASE.F90 to hold all the interesting useful parameters etc.. the use of modules and types. Mostly unknown when I learnt Fortran in 1978.
I translated the CCCC... number into binary, I did not think of hexadecimal.
Arrays that are not initialized seem to hold the random data that is in memory at the time, but single variables, I, J, K etc would appear to be set to the CCCC.. number. A simple statistical analysis says that the odds that all of the numbers on the graph above being set to one value and it being random is in the range of the number of grains of sand on a beach. The standard may be silent on it, but humans being human, someone found it useful.
The beauty of CCCCCC is it would be easy to spot in a dump and it is a long way from zero.
In this interesting quest, I have seen a treatise on whether arrays should be 0 or 1 index start. That is like asking if you like milk in the your tea, of course if it is Earl Grey the correct answer is of course lemon. [I am mocking Mr Cage.]
I have been unable, using any of the browsers I use, to get a message accepted for about the last two days. I had to assume it was happening to a lot of people as there were no new posts and that is statistically unlikely for this forum, the MKL forum yes, this one no.
I had tried several messages and none posted, I did not expect the last one to post and I was pleasantly surprised when it did.
It can be viewed as a Testing 1, 2, 3 message, which is of course not logical as it is neither a sentence nor a simple question, except most people know the signal -- I explained in the message my inability to log on - the rest is just testing 1,2,3.
There is no humour, just a desire to see if it worked.
I now have the answer, yes it works.
For the users that are having access issues, can you provide more details?
- Error message (provide a screenshot if possible)
- Did you try different browsers? I see that you are using Chrome* and Firefox*, If you can log in using a different browser then the issue may not be related to your account but to the browser.
- Did you try regular browser troubleshooting: clean cookies, delete temporary Internet files?
- Did you try accessing from a different computer, phone, or tablet?
- How did you log in today 10-22-2021?