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

Does the order of the compiler options matter?

Sanematsu__Paula
Beginner
320 Views

I was debugging my Fortran code with some compiler options and, during runtime, the following error came up:

forrtl: severe (194): Run-Time Check Failure. The variable 'readinputfiles_$I3' is being used in 'main.F90(796,10)' without being defined

I changed the compiler options to 

 -O0 -g -debug all -ftrapuv -check bounds -check all -traceback -i8

But I can't get the same error (the code was not changed). In addition, I know for sure that one array is being accessed with an out of bounds index, but I also don't get any runtime error. I am wondering whether the order of the compiler options matters? Or maybe I am doing something wrong in my makefile?

Here is my makefile:

debugFFLAGS = -O0 -g -debug all -ftrapuv -check bounds -check all -traceback -i8
debugEXE = debug.exe

# local installation of PETSc
PETSC_DIR=~/software/petsc-3.7.6

include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules

OBJS = main.o modGlobal.o

# object dependencies
modGlobal.o : modGlobal.F90
main.o      : main.F90 modGlobal.o

debug: ${OBJS}
   -${FLINKER} ${debugFFLAGS} ${OBJS} -o ${debugEXE} ${PETSC_LIB} ${LDLIBS}

 

0 Kudos
3 Replies
Lorri_M_Intel
Employee
320 Views

Changed your options from what?

Also, if this is your whole makefile, your options are only being applied to the link step not the compilation step.  

For compilation, you are only getting the default values of all command line options.

                       --Lorri

0 Kudos
Sanematsu__Paula
Beginner
320 Views

Lorri Menard (Intel) wrote:

Changed your options from what?

That's part of my problem. I don't remember exactly the options that I had before. However, they were also defined in the variable $debugFFLAGS in the same way as the makefile shown above (so, they were only applied to the link step as you pointed out).

Lorri Menard (Intel) wrote:

Also, if this is your whole makefile, your options are only being applied to the link step not the compilation step.  

For compilation, you are only getting the default values of all command line options.

                       --Lorri

I see. This is a Fortran code with MPI. This is my first time compiling an MPI code. Would you be able to provide some guidance or an example on how to add option to the compilation step? Or should I seek help else where?

I really appreciate your help!

0 Kudos
Sanematsu__Paula
Beginner
320 Views

Since I am using PETSc, the variables FLINKER and FFLAGS must be used in the makefile because they are predefined. When I changed the variable name from debugFFLAGS to FFLAGS, I was able to reproduce the runtime error.

0 Kudos
Reply