Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29392 Discussions

Implicit interfaces with optional arguments release/debug issue/question

acar
Beginner
3,945 Views
I'm converting my application written in debug mode to release mode and am noticing an issue. The issue seems to be occurring in a routine that has optional arguments but no explicit interface. It works fine in debug mode but in release mode, whilst the routine is entered, it appears to crash when I do a check for the presence of one of the optional arguments (if(present(opt_arg))then.... Is this behaviour to be expected? I have attached the compiler command lines for both debug and release versions and also the routine in question. The call to this routine that causes the crash is with no optional arguments.
0 Kudos
23 Replies
acar
Beginner
735 Views
Thank you all for your input on this one. The penny has now dropped! I will add an explicit interface and ensure that I always do from now on! I think what I have found confusing is that there do exist out-of-standard coding practices that can get past the compiler. I only picked this one up by the process of going from debug to release mode and getting different behaviour from the resulting executable. There have been other issues with this change of mode: 1) The switch from Debug Information Format = Full to = None highlighted different behaviour as a result of a (single) undefined variable; 2) Changing the Runtime Library from = Debug to = Full lead to an issue with duplicate library definitions LIBCMT and LIBCMTD. Thanks again. ACAR.
0 Kudos
mecej4
Honored Contributor III
735 Views
> The penny has now dropped! -- ???
From The Urban Dictionary:

The phrase dates back to the Victorian Era and the popular penny-slot arcades.

The penny would often stick halfway down the slot and the user would then have to either wait, or give the machine a thump before the 'penny finally dropped' and they could begin playing.

The plays between compiler options and buggy code can be as variegated and full of surprises as the plays between Wile E. Coyote and B.B. Roadrunner.
0 Kudos
acar
Beginner
735 Views
You're right mecej4! I've just looked at a couple of those plays and think that I'll look at them again whenever I get 'cheesed-off' with my buggy code!!
0 Kudos
Reply