Compiling the following code with /home/veksler/gcc-4.0.0/bin/g++ -Wall -O2 -c bug.cpp (Works fine with -O0 or with gcc-3.4.3) Gives: bug.cpp: In function 'bool foo(bar*, bar*)': bug.cpp:19: warning: control may reach end of non-void function 'bool bar_less::operator()(bar*, bar*)' being inlined Which: 1. Is obviously incorrect. 2. Does not give a line number inside bar_less::operator() ---------- bug.cpp --- struct bar; bool operator<(const bar&, const bar&); class bar_less { public: bool operator()(bar* x, bar* y) { bool validX = x, validY = y; if(validX && validY) return (*x < *y); else return false; } }; bool foo(bar *x, bar *y) { bar_less comp; return comp(x,y); }
*** This bug has been marked as a duplicate of 19699 ***
(In reply to comment #1) > > *** This bug has been marked as a duplicate of 19699 *** Shouldn't it be marked as a duplicate of 19583 instead, and 19583 be reopened?
(In reply to comment #3) > (In reply to comment #1) > > > > *** This bug has been marked as a duplicate of 19699 *** > > Shouldn't it be marked as a duplicate of 19583 instead, and 19583 be reopened? No because this and PR 19699 have the same issue, there is extra dead code either produced by the compiler or the user.