- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to use -check uninit to find uninitialized variables in my code:
+ mpif90 -I/usr/local/other/SLES11.3/ncl/gcc-4.3.4/6.3.0-static/include -I/usr/local/other/SLES11.3/silo/4.10.2/include -extend-source -r8 -c -O2 -g -traceback -check uninit -warn noalign 3dpic_full_mpi.f
+ mpif90 -o 3dpic_full_mpi.exe 3dpic_full_mpi.o -L/usr/local/other/SLES11.3/ncl/gcc-4.3.4/6.3.0-static/lib -L/usr/local/other/SLES11.3/silo/4.10.2/lib -lsiloh5 -lhdf5_hl -lhdf5 -lsz -lz -lm -lrt -ldl -lstdc++ -O2 -g -traceback -check uninit -mcmodel medium
But it doesn't work.
Can you tell me what should I do?
Thanks
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note, the command line switches -check uninit and -init snan change *runtime* behavior, they do not trigger any sort of message at compile time.
Is that, perhaps, the confusion?
--Lorri
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-check uninit has some significant restrictions. It works on local routine scalar variables only You might find -init=snan (requires version 16) to be useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
My routines are local: they are called in the main. I'll try the version 16.
Tim, here they are, for the second I get an error:
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.144 Build 20140120 Copyright (C) 1985-2014 Intel Corporation. All rights reserved.
GNU ld (GNU Binutils; SUSE Linux Enterprise 11) 2.23.1
/usr/local/intel/Composer/composer_xe_2013_sp1.2.144/compiler/lib/intel64/for_main.o: In function `main':
/export/users/nbtester/efi2linux_nightly/branch-14_0/20140121_010000/libdev/frtl/src/libfor/for_main.c:(.text+0x42): undefined reference to `MAIN__'
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the compile step failed to put the main program in .o there should be an earlier error message. -check uninit should have no effect in the link step which produced the quoted message. Adding -# option would provide more detail in link step. You might try comparing result of nm *.o with and without -check to see if that option is responsible for missing MAIN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
probably you have misunderstood me.
I obtain the message above once I type the command you told me to try: mpif90 -V -fc =ifort
Thanks
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
-check uninit has some significant restrictions. It works on local routine scalar variables only You might find -init=snan (requires version 16) to be useful.
Hi Steve,
I explicitly inserted an uninitialized variable in the main (as write(*,*) gurdulu, where gurdulu is the not init. variable, never defined before)
I did the commands I report below and nothing was displayed.
cluster05 121% mpif90 -I/usr/local/other/SLES11.3/ncl/gcc-4.3.4/6.3.0-static/include -I/usr/local/other/SLES11.3/silo/4.10.2/include -extend-source -r8 -c -O2 -g -traceback -init=snan -warn noalign 3dpic_full_mpi.f
cluster05 122% mpif90 -o 3dpic_full_mpi.exe 3dpic_full_mpi.o -L/usr/local/other/SLES11.3/ncl/gcc-4.3.4/6.3.0-static/lib -L/usr/local/other/SLES11.3/silo/4.10.2/lib -lsiloh5 -lhdf5_hl -lhdf5 -lsz -lz -lm -lrt -ldl -lstdc++ -O2 -g -init=snan -traceback -mcmodel medium
I'm using these modules (I work on a cluster):
cluster05 113% module load comp/intel-16.0.2.181
cluster05 114% module load mpi/sgi-mpt-2.13
Thanks
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note, the command line switches -check uninit and -init snan change *runtime* behavior, they do not trigger any sort of message at compile time.
Is that, perhaps, the confusion?
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lorri Menard (Intel) wrote:
Please note, the command line switches -check uninit and -init snan change *runtime* behavior, they do not trigger any sort of message at compile time.
Is that, perhaps, the confusion?
--Lorri
Yes, I didn't get that. Thanks!
Is there a way to receive a message when a variable is not defined? I'm losing a lot of time for typos in the variable names!
When I was using gcc for compiling C++ I wasn't able to compile if there was an undefined variable!
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add IMPLICIT NONE to the beginning of the declarations section of every Fortran subprogram. Be prepared to receive a large number of "undeclared variable XYZ" warnings after you have made this change.
An alternative is to ask the compiler to give you a cross-reference listing of variables. You can then look at this listing to spot misspelled variable names.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:
Add IMPLICIT NONE to the beginning of the declarations section of every Fortran subprogram. Be prepared to receive a large number of "undeclared variable XYZ" warnings after you have made this change.
An alternative is to ask the compiler to give you a cross-reference listing of variables. You can then look at this listing to spot misspelled variable names.
Thanks! but this last one would work only for misspelled names, right?
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GB wrote:
Thanks! but this last one would work only for misspelled names, right?
Yes. You can catch such errors using /warn:unused, and some of the others by using the various sub-options of the /warn compiler option.
There exist third party tools for generating complete variable declarations from Fortran source containing the ubiquitous
IMPLICIT REAL*8 (A-H,O-Z)
that one finds in old F77 code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:
Add IMPLICIT NONE to the beginning of the declarations section of every Fortran subprogram. Be prepared to receive a large number of "undeclared variable XYZ" warnings after you have made this change.
An alternative is to ask the compiler to give you a cross-reference listing of variables. You can then look at this listing to spot misspelled variable names.
Hi, implicit none would work very well for undeclared variables. Is there something for UNDEFINED variables?
Thanks
GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Catching undefined variables is quite difficult. Some can be caught at compile time, but mostly they occur at run time. The hardest to catch are those related to components of user-defined types, arguments to subroutines, errors and misconceptions about what INTENT(IN), INTENT(OUT) imply.
Intel Fortran can, with the appropriate options, help catch some, but its emphasis is on producing fast code. There are other compilers that are more helpful in debugging code containing undefined variables.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page