Author Topic: Optimize even more (for speed) [-02] ?  (Read 6410 times)

Offline dominover

  • Multiple posting newcomer
  • *
  • Posts: 46
Optimize even more (for speed) [-02] ?
« on: July 15, 2014, 10:15:08 am »

In the compiler flags for Code::Blocks version 13.12 the flag Optimize even more (for speed) [-02] is checked for Release Versions.

While my program will compile fine (without errors) when this is checked, I get a fatal error during run-time.

I have subsequently unticked this box. Deleted the object files and recompiled the program and it works fine during run-time.  I'm wondering why this would cause an error?  Are there any common reasons why this would happen?   

Thanks
Dom

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Optimize even more (for speed) [-02] ?
« Reply #1 on: July 15, 2014, 01:51:50 pm »
I have never had this problem; but, the posts I read about others having it are:

1. Compiler Bug
2. User code does something undefined by the C/C++ standard therefore user error.

Neither of the above causes are things permitted on this forum. http://forums.codeblocks.org/index.php/topic,9996.0.html

I can think of no other causes of this bug.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline dominover

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: Optimize even more (for speed) [-02] ?
« Reply #2 on: July 15, 2014, 01:58:42 pm »
Hmm.. Thanks.. I have never had it before so it's a complete mystery. 
I know that debug versions can mask certain errors but in this case there doesn't seem to be any. 
A complete mystery ???

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Optimize even more (for speed) [-02] ?
« Reply #3 on: July 15, 2014, 09:09:30 pm »
This is most probably some uninitialized variable or memory somewhere in your program.
If you're using threads it might be some race condition.

There are plenty of tools you can use to find it: compiler warning, debugger, printf, valgrind, clang address sanitizer, etc...
(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!]