public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22435] New: Incorrect "may reach end of non-void function" warning
@ 2005-07-12 11:07 fw at deneb dot enyo dot de
  2005-07-12 15:28 ` [Bug c++/22435] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: fw at deneb dot enyo dot de @ 2005-07-12 11:07 UTC (permalink / raw)
  To: gcc-bugs

The code below results in an incorrect warning.  If the "break" statement is
removed, the warning disappears.  The C compiler does not issue the warning for
both programs.

#include <stdlib.h>
// Imports: extern void abort (void) throw () __attribute__ ((__noreturn__));

inline unsigned
convert_watch(int w)
{
  switch (w) {
    case 0:
      return 0;
      // Deleting the following line suppresses the warning.
      break;
    default:
      abort();
  }
}

extern void foo(unsigned);

void
add_fd(int w, int* fdh)
{
  unsigned u = convert_watch(w); // warning: "may reach end..."
  foo(u);                       // silence unused warning
}

-- 
           Summary: Incorrect "may reach end of non-void function" warning
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fw at deneb dot enyo dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/22435] Incorrect "may reach end of non-void function" warning
  2005-07-12 11:07 [Bug c++/22435] New: Incorrect "may reach end of non-void function" warning fw at deneb dot enyo dot de
@ 2005-07-12 15:28 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-12 15:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 15:28 -------


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

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


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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-12 11:07 [Bug c++/22435] New: Incorrect "may reach end of non-void function" warning fw at deneb dot enyo dot de
2005-07-12 15:28 ` [Bug c++/22435] " 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).