public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23441] New: wrong "control may reach end of non-void function" with -O
@ 2005-08-17 13:46 pierre dot chatelier at club-internet dot fr
  2005-08-17 15:16 ` [Bug c++/23441] [4.0 Regression] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: pierre dot chatelier at club-internet dot fr @ 2005-08-17 13:46 UTC (permalink / raw)
  To: gcc-bugs

When turning on optimizations (-O), the following code produces a wrong "control may reach end of 
non-void function" warning

inline float f(float x)
{
  if ((x > 3.1415927) || (x<0))
    return f(-x);
  else
    return 0;
}

float g(void)
{
  return f(0);
}

-- 
           Summary: wrong "control may reach end of non-void function" with
                    -O
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pierre dot chatelier at club-internet dot fr
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/23441] [4.0 Regression] wrong "control may reach end of non-void function" with -O
  2005-08-17 13:46 [Bug c++/23441] New: wrong "control may reach end of non-void function" with -O pierre dot chatelier at club-internet dot fr
@ 2005-08-17 15:16 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-17 15:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-17 15:10 -------
Fixed in 4.1.0 already by doing the warnings for all functions with flow control instead of just trying 
adhack doing it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |diagnostic
         Resolution|                            |FIXED
            Summary|wrong "control may reach end|[4.0 Regression] wrong
                   |of non-void function" with -|"control may reach end of
                   |O                           |non-void function" with -O
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2005-08-17 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-17 13:46 [Bug c++/23441] New: wrong "control may reach end of non-void function" with -O pierre dot chatelier at club-internet dot fr
2005-08-17 15:16 ` [Bug c++/23441] [4.0 Regression] " 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).