...an array temporary was created...

...an array temporary was created...

One of the diagnostics you have in IVF is to warn when an array temporary is created. This is great, as it informs you of potential performance issues. However, the warning message falls shortin that it tells you what was being called, butdoes not indicate where the call is located.

forrtl: warning (402): fort: (1): In call to GRAVITY, an array temporary was cre ated for argument #4 
The solution has 100's of files with 10's of calls to GRAVITY

It would help if the diagnostic message would list the line number and source of where the temporary was created.

Jim Dempsey

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Duly noted. Request ID is DPD200233252. I think a traceback should be issued in this case.

Retired 12/31/2016

Also consider the following...

You have uninitialized variable support whereby you have a flag mechanism to inform the runtime check as to if the variable was initialized. Consider doing the same with the report of the ...an array temporary was created... IOW report each instance once. This way you can catch multiple instances in one debug run without having all the redundant reports scrolling off the screen buffer.

Jim Dempsey

Interesting idea. I'll note that the compiler generates code to do run-time testing of contiguity (where it can't tell at compile-time), so there may be cases where some calls get a temp and some don't.

Retired 12/31/2016


I am making an assumption here...

At the place of the CALL (inlined or not) is where the current code emits the warning message. That call location can contain the one time flag (iow a hidden flag is created at each create temp). Pseudo code:

if(mustMakeTemp) then
if(thisScopeFirstTime) call ReportArrayTemp(__var__, __sub__, __from__, __line__)
thisScopeFirstTime = .false.
temp = arg
call sub(...,arg,...)
if(tempWasCreated) then
arg = temp

The above will not catch where a stride .ne. 1 array is passed several levels before the temp is created. The call trace will determine that, but for only the first instance of the multi-level call. This is ok, because the first instance of multi-level callcatched the occurance once with traceback. All single level instance are uniquely reported.


In version 14, you can set the environment variable FOR_FORCE_STACK_TRACE to 1. This will force a traceback for all Fortran run-time diagnostics. There's a problem on 32-bit Windows only, where you get the traceback but no source, line or routine info - we're looking into that.

Maybe in a future version these diagnostics will always have a traceback.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today