Re: Stack size, and warnings



Dieter Britz wrote:

2. The routine calls itself many times, with array sections
as arguments, and I get a lot of warnings that a temporary
array was allocated. I tried to suppress these with the -w
option, but they don't go away. Why not, and how do I stop
them?

Are these warnings coming out at compile time or at run-time? I think
the latter - they are controlled by the "-check arg_temp_created"
option and you may have turned on all run-time checking with -check or
--C.

However, these warnings are giving you a big clue, and rather than try
to suppress them you should try to determine why they are there and how
to rewrite your code to eliminate them.

What is happening is that you are passing a non-contigous array or
array slice to a routine that has either an implicit interface or an
explicit interface where the receiving argument is not an assumed-shape
array. (DIMENSION(:)). In this situation, the compiled code has to
create a contiguous copy of the array slice because the called routine
is expecting a contiguous array.

One solution is to have the called routine accept an assumed-shape
array and provide an explicit interface - then the array will be passed
by descriptor and no copy will need to be made.

Another solution is to see if you really need to be passing a
non-contiguous array here. Note that the compiler will generate
run-time code to test for contiguity if it doesn't know at
compile-time, so you should not get this warning unless the array
really is non-contiguous.

If you take either of these approaches, then the stack temp array will
not be created and your program will use much less stack.

A third option, which I don't recommend unless you have exhausted the
others, and which works only in the latest Intel compiler (9.1.037 on
Linux), is to tell the compiler to allocate array temporaries on the
heap rather than the stack. In 9.1.037, you have to use the
undocumented switch:

-Qoption,f,"-heap_arrays 0"

In future updates, you'll be able to simply use -heap-arrays
(/heap-arrays on Windows).

Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
My Fortran blog
http://www.intel.com/software/drfortran

.



Relevant Pages

  • Re: K&R2 section 2.7 type conversions (exercise)
    ... warnings), ... we are asked to write a function "htoi(an array)" that accomplishes ... value of type char. ... int main{ ...
    (comp.lang.c)
  • Re: matching password problem
    ... and turn on warnings. ... You don't need to store the usernames and passwords in arrays in your code, because you only need to look at ONE username and ONE password at a time. ... And if you DID want to store them, you should use a hash, not an array. ... use strict; use warnings; ...
    (perl.beginners)
  • Re: error when linking
    ... That means that in code, symbol "Foo" is used as an array, but compiler ... REAL FOO ...
    (comp.lang.fortran)
  • Re: Compiler warnings
    ... i followed your advice and no more warnings from the compiler. ... pointer, which points to 15 double* arrays, that each contain ... Since the parameters are statically defined, the array is most ...
    (comp.soft-sys.matlab)
  • Re: Question on loops and return values
    ... You should always enable warnings when developing Perl code! ... > associated with an array, but I could be wrong on that too. ... It cannot be clobbered since your program never writes to that filehandle. ...
    (comp.lang.perl.misc)