Bug 19699 - [4.0/4.1 Regression] warning about not returning from end of a non-void function because of dead code
Summary: [4.0/4.1 Regression] warning about not returning from end of a non-void funct...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.0.0
: P2 minor
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
: 21183 21191 21290 21483 21572 21800 22435 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-29 19:22 UTC by Andrew Pinski
Modified: 2005-07-12 15:28 UTC (History)
12 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-01-30 15:02:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-01-29 19:22:14 UTC
Reduced testcase (why don't we remove the dead code before inlining).
void g(void);
inline int f(void)
{
  return 1;
  g();
}
int h(void)
{
  return f();
}

Note this is reduced from:
#include <string>
#include <vector>
void foo(std::vector<std::string> & matches)
{
 char * buf[10];
 matches.insert(matches.end(), buf, buf + 10);
}

(also why does libstdc++ have dead code in its headers.
Comment 1 Andrew Pinski 2005-01-29 19:25:27 UTC
I also happens with the C front-end too.
Comment 2 Richard Henderson 2005-01-30 09:48:34 UTC
There is zero chance that this will be fixed for 4.0.  That's exactly why Ian
implemented the minimalistic check that he did in solving PR19583 and related.

You may retartget this pr to fixing the silliness in libstdc++, if you want.
Comment 3 Andrew Pinski 2005-01-30 15:02:09 UTC
Confirmed.
Comment 4 Andrew Pinski 2005-01-30 15:05:48 UTC
(In reply to comment #2)
> You may retartget this pr to fixing the silliness in libstdc++, if you want.
Actually it is only silliness as try/catch is changed to be "if (true)"/"if (false)" if we don't have exceptions.  
There is nothing can be done to the libstdc++ headers to fix this.
Comment 5 Andrew Pinski 2005-04-23 23:14:13 UTC
*** Bug 21183 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2005-04-24 15:23:47 UTC
*** Bug 21191 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2005-04-29 21:52:19 UTC
*** Bug 21290 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2005-05-10 17:36:55 UTC
*** Bug 21483 has been marked as a duplicate of this bug. ***
Comment 9 Andrew Pinski 2005-05-14 18:14:08 UTC
*** Bug 21572 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2005-05-28 17:46:08 UTC
*** Bug 21800 has been marked as a duplicate of this bug. ***
Comment 11 Andrew Pinski 2005-05-28 17:50:06 UTC
Fixed on the mainline by the moving the warning to right after CFG creation which is now done for all 
functions, even unused ones.
Comment 12 İsmail Dönmez 2005-05-29 07:41:36 UTC
Will the patch be applied to 4.0 branch too? 
Comment 13 Andrew Pinski 2005-05-29 14:16:05 UTC
(In reply to comment #12)
> Will the patch be applied to 4.0 branch too? 
No because it is too big in that it also changes the inliner to be a CFG aware inliner.
Comment 14 Michael Veksler 2005-06-06 15:20:08 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > Will the patch be applied to 4.0 branch too? 
> No because it is too big in that it also changes the inliner to be a CFG aware
inliner.

In that case, it should not be marked "RESOLVED" for gcc-4.0 until:
  1.  either it is marked WONTFIX for gcc-4.0
  2.  or a new patch is written specifically for the gcc-4.0 branch.

From comment #2 I understand that option 2 is out of the question.
Does it mean that "gcc-4.0 is dead, long live gcc-4.1" ?

This is how I came to this "conclusion":
There are new (not very rare) regressions in gcc-4.0 that will never
be fixed. These regressions will be fixed only in gcc-4.1.
As a result, it sounds like gcc-4.0 is much less maintained than
any other (active) branch (or trunk) at the moment. This is
very different from any of the previous releases of GCC (up to
gcc-2.95)

If this is true, then gcc-4.1 schedule should be changed
to reflect that.
Comment 15 Andrew Pinski 2005-06-06 16:07:38 UTC
(In reply to comment #14)
> This is how I came to this "conclusion":
> There are new (not very rare) regressions in gcc-4.0 that will never
> be fixed. These regressions will be fixed only in gcc-4.1.
> As a result, it sounds like gcc-4.0 is much less maintained than
> any other (active) branch (or trunk) at the moment. This is
> very different from any of the previous releases of GCC (up to
> gcc-2.95)

This is only a diagnostic regression.  In fact before this patch which added the warning in the inliner, 
we had a diagnostic regression.  So it is either false postive or false negatives.  Take your pick, I rather 
have the false postives as it means you have to look at your code to double check, if we don't get a 
diagnostic at all, the person will complain when we get it right again the next major release.  Again take 
your pick.
Comment 16 Andrew Pinski 2005-06-07 18:00:51 UTC
*** Bug 21951 has been marked as a duplicate of this bug. ***
Comment 17 Andrew Pinski 2005-07-12 15:28:54 UTC
*** Bug 22435 has been marked as a duplicate of this bug. ***