public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20681] another wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
@ 2005-03-29  9:55 ` oliverst at online dot de
  2005-03-29  9:56 ` oliverst at online dot de
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: oliverst at online dot de @ 2005-03-29  9:55 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|another wrong "control      |another wrong "control
                   |reaches end of non-void     |reaches end of non-void
                   |function"                   |function" warning


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


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

* [Bug c++/20681] New: another wrong "control reaches end of non-void function"
@ 2005-03-29  9:55 oliverst at online dot de
  2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: oliverst at online dot de @ 2005-03-29  9:55 UTC (permalink / raw)
  To: gcc-bugs

The following code causes a wrong warning (I couldn't reduce it to less):

#include <set>

using namespace std;

struct CExtendedEmailInfo {
	   bool _s;
};

struct CMetaBitField {
	   int _type;
	   int GetType() const{
	   	   return _type;
	   }
	   
	   bool operator < (const CMetaBitField&) const {
	   		return true;
	   }
};

int GetMetaCombination (CExtendedEmailInfo& info)
{
     try
     {
          if (info._s)
          {
               set<CMetaBitField> _bitfields;

               set<CMetaBitField>::iterator bi;
               if (bi != _bitfields.end())
               {
                    const CMetaBitField& bf = *bi;
                    switch (bf.GetType())
                    {
                    case 0:
                         {
                              return 17;
                         }
                         break;

                    case 1:
                         {
                              return 18;
                         }
                         break;

                    default:
                         // really shouldn't happen, but just in case...
                         return 0;
                    }
                    
               }
               else
               {
                    return 0;
               }
          }
          else
          {
               return 0;
          }
     }
     catch (...)
     {
          return -1;
     }
}

 C:\Dev-Cpp\Projects\test-stlport\main_6.cpp In function 'int
GetMetaCombination(CExtendedEmailInfo&)': 
66 C:\Dev-Cpp\Projects\test-stlport\main_6.cpp [Warning] control reaches end of
non-void function 

I am using:

Using built-in specs.
Target: i686-pc-mingw32
Configured with: /datal/gcc/gcc/configure --prefix=/datal/gcc/build/wingcc
--build=i686-pc-linux-gnu --host=i686-pc-mingw32 --target=i686-pc-mingw32
--enable-languages=c,c++,java --with-gcc --with-gnu-as --with-gnu-ld
--enable-threads=win32 --disable-nls --disable-win32-registry --disable-shared
--disable-debug --without-newlib --enable-libgcj --disable-java-awt --without-x
--enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-sjlj-exceptions --enable-libgcj-multifile
--enable-libgcj-mingw-osapi=ansi
Thread model: win32
gcc version 4.0.0 20050324 (prerelease)

-- 
           Summary: another wrong "control reaches end of non-void function"
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oliverst at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/20681] another wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
  2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
@ 2005-03-29  9:56 ` oliverst at online dot de
  2005-03-29 20:13 ` [Bug c++/20681] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: oliverst at online dot de @ 2005-03-29  9:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From oliverst at online dot de  2005-03-29 09:56 -------
Created an attachment (id=8482)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8482&action=view)
preprocessed source


-- 


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
  2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
  2005-03-29  9:56 ` oliverst at online dot de
@ 2005-03-29 20:13 ` pinskia at gcc dot gnu dot org
  2005-04-05  1:33 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-29 20:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-29 20:13 -------
Reduced testcase:
struct a{~a();a();};
int GetMetaCombination (int a2)
{
  a bi;
  switch (a2)
  {
    case 1:
      return 18;
      break;//removing this works around the warning
    default:
      return 0;
  }
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-29 20:13:16
               date|                            |
            Summary|another wrong "control      |[4.0/4.1 Regression] wrong
                   |reaches end of non-void     |"control reaches end of non-
                   |function" warning           |void function" warning
   Target Milestone|---                         |4.0.1


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (2 preceding siblings ...)
  2005-03-29 20:13 ` [Bug c++/20681] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-05  1:33 ` pinskia at gcc dot gnu dot org
  2005-04-08 21:46 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-05  1:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-05 01:33 -------
This is also a rejects valid with -Werror.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Target Milestone|4.0.1                       |4.0.0


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (3 preceding siblings ...)
  2005-04-05  1:33 ` pinskia at gcc dot gnu dot org
@ 2005-04-08 21:46 ` mmitchel at gcc dot gnu dot org
  2005-04-09 16:59 ` fsm at robots dot ox dot ac dot uk
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-04-08 21:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-04-08 21:46 -------
Removing rejects-valid; treating all incorrect warnings as rejects-valid due to
-Werror is not useful.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (4 preceding siblings ...)
  2005-04-08 21:46 ` mmitchel at gcc dot gnu dot org
@ 2005-04-09 16:59 ` fsm at robots dot ox dot ac dot uk
  2005-04-21  5:03 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: fsm at robots dot ox dot ac dot uk @ 2005-04-09 16:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fsm at robots dot ox dot ac dot uk  2005-04-09 16:58 -------
*** Bug 20918 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fsm at robots dot ox dot ac
                   |                            |dot uk


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (5 preceding siblings ...)
  2005-04-09 16:59 ` fsm at robots dot ox dot ac dot uk
@ 2005-04-21  5:03 ` mmitchel at gcc dot gnu dot org
  2005-07-08  1:41 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-04-21  5:03 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.0                       |4.0.1


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (6 preceding siblings ...)
  2005-04-21  5:03 ` mmitchel at gcc dot gnu dot org
@ 2005-07-08  1:41 ` mmitchel at gcc dot gnu dot org
  2005-08-03  0:37 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-08  1:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.1                       |4.0.2


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (7 preceding siblings ...)
  2005-07-08  1:41 ` mmitchel at gcc dot gnu dot org
@ 2005-08-03  0:37 ` pinskia at gcc dot gnu dot org
  2005-08-17 15:56 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-03  0:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-03 00:37 -------
Hmm, seems like anything after a "return" should be removed even before CFG was created:

        return D.1766;
        goto <D1765>;

I think I might get around to implementing that but it might take me some time.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (8 preceding siblings ...)
  2005-08-03  0:37 ` pinskia at gcc dot gnu dot org
@ 2005-08-17 15:56 ` pinskia at gcc dot gnu dot org
  2005-08-17 22:34 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-17 15:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-17 15:55 -------
This is a dup of bug 20624, see comment #13.  I wonder why useless  did not remove the goto.

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

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


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (9 preceding siblings ...)
  2005-08-17 15:56 ` pinskia at gcc dot gnu dot org
@ 2005-08-17 22:34 ` pinskia at gcc dot gnu dot org
  2005-08-17 22:47 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:10 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-17 22:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-17 22:33 -------
Reopening as I have a fix for PR 20624 but this one is harder, there might be others too.

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


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (10 preceding siblings ...)
  2005-08-17 22:34 ` pinskia at gcc dot gnu dot org
@ 2005-08-17 22:47 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:10 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-17 22:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug c++/20681] [4.0/4.1 Regression] wrong "control reaches end of non-void function" warning
  2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
                   ` (11 preceding siblings ...)
  2005-08-17 22:47 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:10 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:10 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
2005-03-29  9:56 ` oliverst at online dot de
2005-03-29 20:13 ` [Bug c++/20681] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-04-05  1:33 ` pinskia at gcc dot gnu dot org
2005-04-08 21:46 ` mmitchel at gcc dot gnu dot org
2005-04-09 16:59 ` fsm at robots dot ox dot ac dot uk
2005-04-21  5:03 ` mmitchel at gcc dot gnu dot org
2005-07-08  1:41 ` mmitchel at gcc dot gnu dot org
2005-08-03  0:37 ` pinskia at gcc dot gnu dot org
2005-08-17 15:56 ` pinskia at gcc dot gnu dot org
2005-08-17 22:34 ` pinskia at gcc dot gnu dot org
2005-08-17 22:47 ` pinskia at gcc dot gnu dot org
2005-09-27 16:10 ` mmitchel 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).