2010/7/23 Andy Koppe <andy.ko...@gmail.com>: > On 23 July 2010 09:24, Huang Bambo wrote: >> The current gcc( 4.3.4 ) has some bug with O3 option. it will >> optimized out some needed code in some case. >> I meet this bug when I compile ACE library. >> If I use O2 option, everything goes fine. > > Have you got any actual evidence for this being a bug in gcc rather > than in your program? It's quite common that subtle program bugs get > exposed differently by different optimisations. This might also be > relevant:
It's a very simple test program: #include <ace/Log_Msg.h> int ACE_TMAIN( int argc, ACE_TCHAR **argv ) { ACE_DEBUG(( LM_DEBUG, ACE_TEXT("%D\n") )); return 0; } Gcc optimized out some code like *fp++ = *format_string ++; When I gdb to that line and "print fp", gdb reported that fp is optized out... If I compile ACE library with -O2, everything become OK. I will check if this will happen in other platform when I have time. > http://en.wikipedia.org/wiki/Aliasing_(computing)#Conflicts_with_optimization > > Andy > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple