Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difference in debug and release versions

Status
Not open for further replies.

fede6

Programmer
Jan 24, 2010
2
US
HI!

I have a tricky question.

I've a simple code that does some operation (no more than addition and multiplication) with complex number.

I've compiled my code with the -g option and with the -o3. And some of the resulting values are different.
So I started inserting some WRITE statements in the intermediate computation and some of the previous results that were different now are exactly the same!!

So I tought it happened because in some point are made some read or write over the array bound. I've run Valgrind and it didn't found any errors or illegal value access.

What can I do?
I believe that both using the -o3 and -g compiling option yhe results must be the same! And, in addition, that insertint WRITE statements will not modify the results!!!!

thank you very much !

Federico
 
I don't know the exact cause, but I had this once or twice in a life time.

It only occured to me in F77, it seems magic, and it always turned out to be something with the indexes of the arrays.

(It might be something with a duplicate statement, a variable name that ocurred as a subroutine, function, common, programname or whatever.

I'd check the indexes of my arrays first.
 
Thank you GerritGroot,

I'm removed from my code everything that was unnecessary,
all the subroutines/functions, I've transformed allocatable array in fixed length array.
I've also checked that any operation exceed the arrays boundary.

I run the code under Valgrind, with the memcheck tool and it didn't fine anything,. I use the pointer-check tool and it give me a lot of "Invalid read" messages at the line where OPEN, READ, WRITE function were used.

Do you thing the problem can be related to those function?
How can I go over them?

thank you very much,

Federico
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top