Author Topic: why is the result different in debug and release mode?  (Read 15961 times)

Offline facat

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: why is the result different in debug and release mode?
« Reply #15 on: April 16, 2011, 01:17:04 pm »
how to update the gcc and g++ version in my CB?

Offline facat

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: why is the result different in debug and release mode?
« Reply #16 on: April 16, 2011, 07:01:35 pm »
I compiled my project in my friend's computer. He has a AMD cpu. to my surprise, the result is right.
i'm using cpu I5, i think this has something to do with my cpu. maybe there is a complile bug on a I5 cpu computer?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12069
    • Travis build status
Re: why is the result different in debug and release mode?
« Reply #17 on: April 16, 2011, 07:14:59 pm »
The only way to be sure it is a compiler bug, is to check the assembly.
But I'm pretty sure you have a bug in you code, you just have to find it :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline facat

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: why is the result different in debug and release mode?
« Reply #18 on: April 17, 2011, 06:59:49 am »
The only way to be sure it is a compiler bug, is to check the assembly.
But I'm pretty sure you have a bug in you code, you just have to find it :)


code bug?then how can this explain that my project is normal in my vs2005 and in CB on my friend's AMD computer?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12069
    • Travis build status
Re: why is the result different in debug and release mode?
« Reply #19 on: April 17, 2011, 08:56:23 am »
Sometimes a bug is revealed by a special combination of computer, gcc, moon phaze, etc.
Also is you computer stable?

btw, this is not C::B related, so please ask more questions on the mingw/gcc mailing list
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: why is the result different in debug and release mode?
« Reply #20 on: April 17, 2011, 10:47:00 am »
Due to optimization you might have different memory boundaries in debug and release code also some functions might be inlined with, but not without optimization.
And there are many other possible other sources of trouble.

This might be the cause for your errors.

You have to be sure that your code works stable on any system, with any byte-order and on 32 and 64-bit.

You can try to add some debug-statements (cout's or printf's) to find the place where something goes wrong.