Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
告知
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29310 ディスカッション

different ouput with -g and -O0

hans-christoph_ploig
ビギナー
605件の閲覧回数
Hi,
I am getting different output from my program depending on wether I compile (ifort 8.1.034) it with -g or -O0 (the only parameters used). Even more confusing, I get changes in the output when I put a write(*,*) 'TEST' in my program (line 281). This happens on my system (Pentium M, Suse Linux 9.3, kernel 2.6.11.4-21.10-default) as well as on an other system (Pentium 4, Suse Linux 9.0, kernel 2.4.21-215-default) but here with even other output values.
The program is quite big for being a test case but the two parts it consists of are working well. It is a simulation which takes 3 parameters for calculating the output and a genetic algorithm for finding the 3 parameters. The simulation gives the same results with -g and -O0 on both computers as well as the genetic algorithm (with a small test function to optimize).
The standard option -O2 can't be used because I get a segmentation fault (already with the simulation without genetic algorithm), a thing I still have to trace back. (ulimit -s unlimited is not the reason).
Thank you for your ideas!
(I attached the program with its input file perhaps somebody can reproduce this bevavior)

0 件の賞賛
2 返答(返信)
Steven_L_Intel1
従業員
605件の閲覧回数
I don't see your attachment, but anything that changes the memory layout can create this sort of problem for a program that is accessing uninitialized memory. It sounds very much as if you have a coding error in there somewhere - could be an out of bounds array reference or a mismatch in types across a call.
hans-christoph_ploig
ビギナー
605件の閲覧回数
I changed the code in a way that it runs with the -O2 option. I had to call a function directly which was given as a parameter to another function before (delta_E called by brent). Surprising, I still have to find the reason. I don't get array access errors with -C, but anyway I still get different output for -O2, -O0 and -g compile options. I go on trying to find the point where the versions differ and attach the files to see if somebody can reproduce the behavior (wether it is a code or system dependent behavior).
返信