Bug 21483 - Spurious 'control may reach end of non-void function' ... being inlined
Summary: Spurious 'control may reach end of non-void function' ... being inlined
Status: RESOLVED DUPLICATE of bug 19699
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-10 06:16 UTC by Michael Veksler
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Veksler 2005-05-10 06:16:50 UTC
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);
}
Comment 1 Andrew Pinski 2005-05-10 17:36:53 UTC

*** This bug has been marked as a duplicate of 19699 ***
Comment 2 Michael Veksler 2005-05-11 03:52:39 UTC
(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?
Comment 3 Michael Veksler 2005-05-11 03:53:02 UTC
(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?
Comment 4 Andrew Pinski 2005-05-11 11:00:34 UTC
(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.