public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
@ 2014-01-23 11:35 Bernhard.Rosenkranzer at linaro dot org
  2014-01-27 11:05 ` [Bug c++/59916] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Bernhard.Rosenkranzer at linaro dot org @ 2014-01-23 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59916
           Summary: [4.9 Regression] constructors and destructors can
                    cause "control reaches end of non-void function"
                    warnings with -Os
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Bernhard.Rosenkranzer at linaro dot org

Created attachment 31929
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31929&action=edit
test case

The following C++ code:

class A
{
};

class B : virtual public A
{
public:
        B();
        virtual ~B();
};

B::B()
{
}

B::~B()
{
}


causes an incorrect warning with current 4.9 git with -Os:

[bero@localhost gcc-test]$ arm-linux-androideabi-g++ -Werror=return-type -Os -o
test.o test.cpp
test.cpp: In constructor 'B::B()':
test.cpp:14:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In constructor 'B::B()':
test.cpp:14:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In destructor 'B::~B()':
test.cpp:18:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
test.cpp: In destructor 'virtual B::~B()':
test.cpp:18:1: error: control reaches end of non-void function
[-Werror=return-type]
 }
 ^
cc1plus: some warnings being treated as errors


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
@ 2014-01-27 11:05 ` paolo.carlini at oracle dot com
  2014-01-28 13:04 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-01-27 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Richard, is this a front-end issue?


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
  2014-01-27 11:05 ` [Bug c++/59916] " paolo.carlini at oracle dot com
@ 2014-01-28 13:04 ` rguenth at gcc dot gnu.org
  2014-01-29 13:34 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-28 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Surely frontend related - after gimplification I see

B::B() (struct B * const this, const void * * __vtt_parm)
{
  struct B * <retval>;

  <retval> = B::B (this, 0, __vtt_parm);
}

which misses a return.


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
  2014-01-27 11:05 ` [Bug c++/59916] " paolo.carlini at oracle dot com
  2014-01-28 13:04 ` rguenth at gcc dot gnu.org
@ 2014-01-29 13:34 ` rguenth at gcc dot gnu.org
  2014-01-29 14:12 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-29 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-29
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed btw.  No, gimple wants a return stmt, so somewhere it goes wrong -
either wrong GENERIC or wrong C++ specific gimplification.


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
                   ` (2 preceding siblings ...)
  2014-01-29 13:34 ` rguenth at gcc dot gnu.org
@ 2014-01-29 14:12 ` jason at gcc dot gnu.org
  2014-01-29 17:13 ` jason at gcc dot gnu.org
  2014-01-29 17:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-29 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
                   ` (4 preceding siblings ...)
  2014-01-29 17:13 ` jason at gcc dot gnu.org
@ 2014-01-29 17:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-29 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


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

* [Bug c++/59916] [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os
  2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
                   ` (3 preceding siblings ...)
  2014-01-29 14:12 ` jason at gcc dot gnu.org
@ 2014-01-29 17:13 ` jason at gcc dot gnu.org
  2014-01-29 17:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-29 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan 29 17:13:01 2014
New Revision: 207271

URL: http://gcc.gnu.org/viewcvs?rev=207271&root=gcc&view=rev
Log:
    PR c++/59916
    * optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
    cdtor_returns_this case.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/optimize.c


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

end of thread, other threads:[~2014-01-29 17:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 11:35 [Bug c++/59916] New: [4.9 Regression] constructors and destructors can cause "control reaches end of non-void function" warnings with -Os Bernhard.Rosenkranzer at linaro dot org
2014-01-27 11:05 ` [Bug c++/59916] " paolo.carlini at oracle dot com
2014-01-28 13:04 ` rguenth at gcc dot gnu.org
2014-01-29 13:34 ` rguenth at gcc dot gnu.org
2014-01-29 14:12 ` jason at gcc dot gnu.org
2014-01-29 17:13 ` jason at gcc dot gnu.org
2014-01-29 17:13 ` jason at gcc dot gnu.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).