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

Debuge version works ok , release version doesn't

steve_konarski
Beginner
871 Views
I have a very large fortran program. In the debug build the program works ok. In the release version the program stops between two inocuous wtite statemends with a returned code of -7. The program has suffered from zero indexed arrays but with the checke on in debug mode - they seem to be resolved . Has anyone any idea how to stop the release version stopping. There must be some corruption somewhere but how do you set about finding it when the debug version works OK.
0 Kudos
6 Replies
mecej4
Honored Contributor III
871 Views
>program stops between two inocuous wtite statemends with a returned code of -7

I'm afraid that this return code means nothing without more explanation. If it is based on internal checks in your code, you will have to look at the various ways in which that code can be triggered.

A program working with no apparent errors in debug mode and errors in release mode is most often a program with errors. It often happens that an error stays dormant until it becomes noticed when the program is run with new input.

Pinpointing the bug may be facilitated by ascertaining INTENT for subprogram arguments and specifying INTENT(IN) or INTENT(OUT), as appropriate. Sometimes a programmer writes a subprogram with certain INTENTs in mind but a later modification (perhaps by another programmer) may violate the INTENT assumed.

I'm afraid this is a time-consuming task, but with large programs such errors are not easily detected if tight control is not exercised when the first writing of code is done.
0 Kudos
steve_konarski
Beginner
871 Views
Thanks thats what i suspected - I have tried setting all the debug checks in but to no avail -
steve
0 Kudos
steve_konarski
Beginner
871 Views
Yes it is new input - but not sure why debug version does not flag the error and just gives a successful run - whereas the release version just crashes out
0 Kudos
anthonyrichards
New Contributor III
871 Views
Sounds like uninitialised variables could be a cause. IMPLICIT NONE is your friend here. try it and see.
Post some code that shows the problem and give the full error message
0 Kudos
steve_konarski
Beginner
871 Views
Managed to find - The program has hundreds of subroutines and when compiling i overlooked a warning that the number of arguments of a subroutine called in one place was different from another place, this was the reason the release version crashed - whereas it was not picked up surprisingly on in the debug version

The program gave a problem on 18 out of 6000 cases - hopefully now resolved
0 Kudos
mecej4
Honored Contributor III
871 Views
The Intel Fortran compiler has options to generate interfaces to subprograms and to check that the interfaces are followed correctly in calls. Not only the number of arguments but their types are checked and, furthermore, if you specify, INTENT.

You may wish to try the compiler with these options turned on on your code.
0 Kudos
Reply