public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16558] New: 3.5: bogus missing-return warning
@ 2004-07-15  1:55 gcc-bugzilla at gcc dot gnu dot org
  2004-07-15  2:00 ` [Bug middle-end/16558] [3.5 Regression]: " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-15  1:55 UTC (permalink / raw)
  To: gcc-bugs



g++ mainline erroneously warns about a missing return for the code below.

$ g++ -c -Wall x.cc
x.cc: In function `int getref(int)':
x.cc:17: warning: control reaches end of non-void function
$

Environment:
System: Linux karma 2.6.7 #18 Wed Jul 14 03:27:01 EDT 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/sss/gcc/gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f95

How-To-Repeat:

-----------------------------------------
struct C
{
  C ();
  ~C ();
};

int getref (int ndx)
{
  C d;

  if (ndx != 0) {
    C base;
    return 0;
  }
  else
    return 0;
}
-----------------------------------------
------- Additional Comments From snyder at fnal dot gov  2004-07-15 01:54 -------
Fix:
	<how to correct or work around the problem, if known (multiple lines)>

-- 
           Summary: 3.5: bogus missing-return warning
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                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=16558


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

* [Bug middle-end/16558] [3.5 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-15  2:00 ` pinskia at gcc dot gnu dot org
  2004-07-15  2:02 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-15  2:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-15 02:00 -------
Confirmed, this is exception related.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-15 02:00:01
               date|                            |
            Summary|3.5: bogus missing-return   |[3.5 Regression]: bogus
                   |warning                     |missing-return warning
   Target Milestone|---                         |3.5.0


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


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

* [Bug middle-end/16558] [3.5 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
  2004-07-15  2:00 ` [Bug middle-end/16558] [3.5 Regression]: " pinskia at gcc dot gnu dot org
@ 2004-07-15  2:02 ` pinskia at gcc dot gnu dot org
  2004-07-27 16:29 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-15  2:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-15 02:02 -------
Really if you add -O1 which turns on optimization, it works because of a try_finnally block.

-- 


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


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

* [Bug middle-end/16558] [3.5 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
  2004-07-15  2:00 ` [Bug middle-end/16558] [3.5 Regression]: " pinskia at gcc dot gnu dot org
  2004-07-15  2:02 ` pinskia at gcc dot gnu dot org
@ 2004-07-27 16:29 ` pinskia at gcc dot gnu dot org
  2004-09-22 18:36 ` [Bug middle-end/16558] [4.0 " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 16:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-27 16:29 -------
*** Bug 16784 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sylvain dot pion at sophia
                   |                            |dot inria dot fr


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-07-27 16:29 ` pinskia at gcc dot gnu dot org
@ 2004-09-22 18:36 ` pinskia at gcc dot gnu dot org
  2004-10-06 21:00 ` dpatel at apple dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-22 18:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org
   Last reconfirmed|2004-07-15 02:00:01         |2004-09-22 18:36:49
               date|                            |


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-22 18:36 ` [Bug middle-end/16558] [4.0 " pinskia at gcc dot gnu dot org
@ 2004-10-06 21:00 ` dpatel at apple dot com
  2004-11-25 20:37 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dpatel at apple dot com @ 2004-10-06 21:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dpatel at apple dot com  2004-10-06 21:00 -------
In gimple-low.c, we have

     88   /* If the function falls off the end, we need a null return statement.
     89      If we've already got one in the return_statements list, we don't
     90      need to do anything special.  Otherwise build one by hand.  */
     91   if (block_may_fallthru (*body_p)
     92       && (data.return_statements == NULL
     93           || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
     94     {
     95       x = build (RETURN_EXPR, void_type_node, NULL);
     96       SET_EXPR_LOCATION (x, cfun->function_end_locus);
     97       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     98     }

And in tree-cfg.c, we have

   5310       FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
   5311         {
   5312           tree last = last_stmt (e->src);
   5313           if (TREE_CODE (last) == RETURN_EXPR
   5314               && TREE_OPERAND (last, 0) == NULL)
   5315             {
   5316 #ifdef USE_MAPPED_LOCATION
   5317               location = EXPR_LOCATION (last);
   5318               if (location == UNKNOWN_LOCATION)
   5319                   location = cfun->function_end_locus;
   5320               warning ("%Hcontrol reaches end of non-void function", &location);
   5321 #else
   5322               locus = EXPR_LOCUS (last);
   5323               if (!locus)
   5324                 locus = &cfun->function_end_locus;
   5325               warning ("%Hcontrol reaches end of non-void function", locus);
   5326 #endif
   5327               break;
   5328             }
   5329         }


These two code fragements need to talk with each other.

-- 


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-10-06 21:00 ` dpatel at apple dot com
@ 2004-11-25 20:37 ` pinskia at gcc dot gnu dot org
  2004-12-15 23:45 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-25 20:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-25 20:37 -------
Maybe we should do simple ccp for compiler generated decls which will fix this and most likely will 
improve compile time at -O0.  Or maybe in the EH lowering part fix up the problem when we know that 
the finally_tmp will always be 0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-09-22 18:36:49         |2004-11-25 20:37:04
               date|                            |


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-11-25 20:37 ` pinskia at gcc dot gnu dot org
@ 2004-12-15 23:45 ` pinskia at gcc dot gnu dot org
  2005-01-28  3:48 ` ian at airs dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-15 23:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-15 23:45 -------
*** Bug 19025 has been marked as a duplicate of this bug. ***

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


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-12-15 23:45 ` pinskia at gcc dot gnu dot org
@ 2005-01-28  3:48 ` ian at airs dot com
  2005-01-28 17:33 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ian at airs dot com @ 2005-01-28  3:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-01-28 03:47 -------
I believe this is fixed by this patch:
    http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02098.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com
           Keywords|                            |patch


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-01-28  3:48 ` ian at airs dot com
@ 2005-01-28 17:33 ` cvs-commit at gcc dot gnu dot org
  2005-01-28 17:34 ` cvs-commit at gcc dot gnu dot org
  2005-01-28 17:35 ` ian at airs dot com
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-28 17:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-28 17:33 -------
Subject: Bug 16558

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ian@gcc.gnu.org	2005-01-28 17:32:58

Modified files:
	gcc            : ChangeLog gimple-low.c 

Log message:
	PR middle-end/16558
	PR middle-end/19583
	* gimple-low.c (block_may_fallthru): TRY_FINALLY_EXPR only falls
	through if both operands fall through.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7319&r2=2.7320
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimple-low.c.diff?cvsroot=gcc&r1=2.20&r2=2.21



-- 


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-01-28 17:33 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-28 17:34 ` cvs-commit at gcc dot gnu dot org
  2005-01-28 17:35 ` ian at airs dot com
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-28 17:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-28 17:34 -------
Subject: Bug 16558

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ian@gcc.gnu.org	2005-01-28 17:33:54

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: Wreturn-type-2.C 

Log message:
	PR middle-end/16558
	* g++.dg/warn/Wreturn-type-2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4950&r2=1.4951
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wreturn-type-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning
  2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-01-28 17:34 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-28 17:35 ` ian at airs dot com
  10 siblings, 0 replies; 12+ messages in thread
From: ian at airs dot com @ 2005-01-28 17:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-01-28 17:35 -------
Fixed in mainline.

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


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


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

end of thread, other threads:[~2005-01-28 17:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-15  1:55 [Bug c++/16558] New: 3.5: bogus missing-return warning gcc-bugzilla at gcc dot gnu dot org
2004-07-15  2:00 ` [Bug middle-end/16558] [3.5 Regression]: " pinskia at gcc dot gnu dot org
2004-07-15  2:02 ` pinskia at gcc dot gnu dot org
2004-07-27 16:29 ` pinskia at gcc dot gnu dot org
2004-09-22 18:36 ` [Bug middle-end/16558] [4.0 " pinskia at gcc dot gnu dot org
2004-10-06 21:00 ` dpatel at apple dot com
2004-11-25 20:37 ` pinskia at gcc dot gnu dot org
2004-12-15 23:45 ` pinskia at gcc dot gnu dot org
2005-01-28  3:48 ` ian at airs dot com
2005-01-28 17:33 ` cvs-commit at gcc dot gnu dot org
2005-01-28 17:34 ` cvs-commit at gcc dot gnu dot org
2005-01-28 17:35 ` ian at airs dot com

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).