public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25390]  New: gcc-4.1.0: Invalid warning: control reaches end of non-void function
@ 2005-12-13 13:00 pmladek at suse dot cz
  2005-12-13 13:09 ` [Bug c++/25390] " pmladek at suse dot cz
  2005-12-13 15:02 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pmladek at suse dot cz @ 2005-12-13 13:00 UTC (permalink / raw)
  To: gcc-bugs




-- 
           Summary: gcc-4.1.0: Invalid warning: control reaches end of non-
                    void function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pmladek at suse dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25390


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/25390] gcc-4.1.0: Invalid warning: control reaches end of non-void function
  2005-12-13 13:00 [Bug c++/25390] New: gcc-4.1.0: Invalid warning: control reaches end of non-void function pmladek at suse dot cz
@ 2005-12-13 13:09 ` pmladek at suse dot cz
  2005-12-13 15:02 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pmladek at suse dot cz @ 2005-12-13 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pmladek at suse dot cz  2005-12-13 13:08 -------
First, I am sorry for the first empty message. I pressed enter too fast.

Well, I have got an invalid warning: control reaches end of non-void function
with gcc-4.1.0-pre

The reduced testcase looks like:

--- cut ---
namespace store
{
  class OStoreFile
  {
  public:inline OStoreFile (void) {};
      inline ~ OStoreFile (void) {};
  };
}
using namespace store;

int test (int i1, int i2)
{
  OStoreFile rRegFile;

  if (i2)
    {
      switch (i2)
        {
        case 1:
          return 1;
          break;
        case 2:
          return 2;
          break;
        default:
          return 0;
          break;
        }
    }
  else
    {
      if (i2 == 10)
          return 2;
      else
        return 3; 
    }
}
--- cut ---

Here is the output from g++:

hope:/tmp/gcc.bug # g++ -c -Wall test.ii
test.ii: In function ‘int test(int, int)’:
test.ii:37: warning: control reaches end of non-void function

hope:/tmp/gcc.bug # g++ --version
g++ (GCC) 4.1.0 20051129 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The warning should not be printed because a value is returned in each case.
It seems that the variable OStoreFile rRegFile; is important to reproduce the
problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25390


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/25390] gcc-4.1.0: Invalid warning: control reaches end of non-void function
  2005-12-13 13:00 [Bug c++/25390] New: gcc-4.1.0: Invalid warning: control reaches end of non-void function pmladek at suse dot cz
  2005-12-13 13:09 ` [Bug c++/25390] " pmladek at suse dot cz
@ 2005-12-13 15:02 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-13 15:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-13 15:02 -------
This is a dup of bug 20681.

The problem is the break following the return.  GCC does not remove it before
lowering.

*** This bug has been marked as a duplicate of 20681 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25390


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-13 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 13:00 [Bug c++/25390] New: gcc-4.1.0: Invalid warning: control reaches end of non-void function pmladek at suse dot cz
2005-12-13 13:09 ` [Bug c++/25390] " pmladek at suse dot cz
2005-12-13 15:02 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).