I'm using the intel fortran compiler (ifort) in an mpi environment. It turns out that my code has a buffer overflow as I compiled with the flags -g -O2 -check bounds. After running a while, I get this message:
forrtl: severe (408): fort: (2): Subscript #1 of the array XX has value 4 which is greater than the upper bound of 3
Image PC Routine Line Source
program.exe 00000000006E757E Unknown Unknown Unknown
program.exe 00000000006E6016 Unknown Unknown Unknown
program.exe 00000000006905B2 Unknown Unknown Unknown
program.exe 0000000000642E6B Unknown Unknown Unknown
program.exe 0000000000643381 Unknown Unknown Unknown
program.exe 00000000005F33FB Unknown Unknown Unknown
program.exe 00000000004139E7 Unknown Unknown Unknown
program.exe 000000000040A6B4 Unknown Unknown Unknown
program.exe 0000000000409D2C Unknown Unknown Unknown
libc.so.6 000000380D61ECDD Unknown Unknown Unknown
program.exe 0000000000409C29 Unknown Unknown Unknown
This is great -- I now know that I'm overrunning XX, but where? using gfortran, -fbounds-check would give me a file and line number. Is there any way that I can get that with ifort?
A -traceback flag may be used with Intel and Portland Group Fortran compilers to request additional information to be generated in object files for line and source traceback. When a severe error occurs during run time, the program will attempt to report line number and source file where the error occured, as well as line numbers and source files from parent procedures where the calls were made.
Equivalent flag for gfortran is -fbacktrace.
Related
I am using a very old Fortran 77 code from third party (also very bugged). I have compiled with
FFLAGS=-O0 -Wall -g -fbacktrace -pedantic -Wextra
I am getting the warning in the title at runtime:
At line <number> of file <namefile>.f (unit=6, file='stdout')
Fortran runtime warning: Extension: $ descriptor
I would like to figure out what that means.
You should always show the code line number in the error or warning message, to which the line points.
The role of $ in
write(*,'(a$)') "string"
is to avoid going to the next line after printing "string" on the screen.
However, the descriptor is non-standard and therefore you are warned about this by the compiler.
The standard way is to use non-advancing input/output:
write(*,'(a)', advance="no") "string"
I have Fortran code that is compiled using mpiifort. I have an error when running this code using mpirun. Bellow I am pasting both how I compile and run. I get two warnings that are ignored, and one error. I believe the error is the real issue, not the warnings. I would greatly appreciate any help!
mpiifort mycode.f90 -r8 -O2 -xHost -override-limits -o output.out
[me#gauss ORIGINALV]$ mpirun -n 1 ./output.out
[gauss:31148] mca: base: component_find: unable to open /usr/local/openmpi/1.10.0/lib/openmpi/mca_plm_tm: libtorque.so.2: cannot open shared object file: No such file or directory (ignored)
[gauss:31148] mca: base: component_find: unable to open /usr/local/openmpi/1.10.0/lib/openmpi/mca_ras_tm: libtorque.so.2: cannot open shared object file: No such file or directory (ignored)
./output.out: symbol lookup error: /srv/home/shaorshadze/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/lib/libmpifort.so.12: undefined symbol: MPI_UNWEIGHTED
Primary job terminated normally, but 1 process returned a non-zero exit code.. Per user-direction, the job has been aborted.
mpirun detected that one or more processes exited with non-zero status, thus causing the job to be terminated. The first process to do so was:
When am trying to get pdg of a code i am getting this invalid symbol error wiht no line numbers for help.
Can any one suggest what this error means? note that code compiles and runs with g++
Question is how to get exact line number for this error.
command executed:
frama-c -continue-annot-error -kernel-verbose 3 -no-annot -no-frama-c-stdlib -cpp-command " /usr/bin/g++ -iquote../../inc -std=c++11 fPIC -Wno-write-strings -Wno-narrowing -gdwarf-3 -o test.o -c" -pdg -pdg-dot test -pdg-print test.cpp
Error message :
[kernel] computing the AST
[kernel] parsing
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing /usr/local/share/frama-c/libc/__fc_builtin_for_normalization.i to Cabs
[kernel] Parsing /usr/local/share/frama-c/libc/__fc_builtin_for_normalization.i
[kernel] Converting /usr/local/share/frama-c/libc /__fc_builtin_for_normalization.i from Cabs to CIL
[kernel] Parsing test.cpp (with preprocessing)
[kernel] Parsing /tmp/test.cppe1a338.i to Cabs
[kernel] Parsing /tmp/test.cppe1a338.i
/tmp/test.cppe1a338.i:1:[kernel] user error: Invalid symbol
[kernel] user error: stopping on file "test.cpp"
that has errors.
[kernel] Frama-C aborted: invalid user input.
Frama-C is meant to analyze C code, not C++ code. These are two different languages, and unless you write plain C (with the caveat that some constructions that look syntactically similar in both languages have in fact different semantics), there is no way Frama-C can parse your test.cpp file.
In addition, as mentioned by Anne in comment, the -cpp-command you have given is incorrect: you have asked g++ to provide a binary file, whereas Frama-C is expecting pre-processed C. As a matter of fact, the error line is mentioned in your log: /tmp/test.cppe1a338.i:1:, but this is meaningless since test.cppe1a338 is a binary file. With an appropriate -cpp-command (such as the one Frama-C gives you by default), Frama-C will find #line annotations which will allow it to report any error at the appropriate location in the original file instead of the intermediate result.
So I'm attempting to compile a header file, a main file, and a function definition file together in Geany. I'm using the command
user#cu-cs-vm:~/Dropbox$ g++ Assignment4.cpp CommunicationNetwork.cpp CommunicationNetwork.h -o Assignment4
But when it executes, I get the error message:
cc1plus: out of memory allocating 3355443200 bytes after a total of 548864 bytes.
Any idea of what could be happening?
If I try to compile the code
#include "armadillo"
int main(int argc, char *argv[]) {
}
using MinGW g++ and latest armadillo (3.6.1), it works fine on my windows XP, but if I compile it and the run it on windows 7 then I get: "A problem caused the program to stop working correctly."
What could cause this?
I have tried with both 4.6.2 and 4.7.2 (g++ -v of latest included next):
Using built-in specs. COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.7.2/configure
--enable-languages=c,c++,ada,fortran,obj c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo mp --disable-win32-registry --enable-libstdcxx-debug
--disable-build-poststage1- with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.7.2 (GCC)
Note that at this stage I am not even linking any library like LAPACK.
I also tried uncommenting
//#define ARMA_USE_LAPACK
in config.cpp, but to no effect.
By the way, I can compile c code without armadillo no problem on both systems. It is only the addition of the armadillo include that causes problems.
Update: If I press ctrl-c I get:
forrtl: error (200): program aborting due to control-C event Image
PC Routine Line Source lapack_win32_MT.d
103A49EA Unknown Unknown Unknown lapack_win32_MT.d
1034CD0E Unknown Unknown Unknown lapack_win32_MT.d
1035B254 Unknown Unknown Unknown kernel32.dll
755B6C19 Unknown Unknown Unknown kernel32.dll
75513677 Unknown Unknown Unknown ntdll.dll
77DFC002 Unknown Unknown Unknown ntdll.dll
77DFBFD5 Unknown Unknown Unknown
Update: On yet another windows 7 system, I do manage to execute but I get the following message at compile time (when compiling example2.cpp in the armadillo package):
Info: resolving vtable for std::exception by linking to __imp___ZTVSt9exception (auto-import)
Info: resolving vtable for std::bad_alloc by linking to __imp___ZTVSt9bad_alloc (auto-import)
Info: resolving std::cout by linking to __imp___ZSt4cout (auto-import)
Info: resolving std::nothrow by linking to __imp___ZSt7nothrow (auto-import)
Info: resolving vtable for __cxxabiv1::__si_class_type_info by linking to __imp___ZTVN10__cxxabiv120__si_class_type_infoE (auto-import)
Info: resolving vtable for __cxxabiv1::__class_type_info by linking to __imp___ZTVN10__cxxabiv117__class_type_infoE (auto-import)
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
Thanks.