public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25156]  New: wrong error message (int instead of bool)
@ 2005-11-29 16:12 joerg dot richter at pdv-fs dot de
  2005-11-29 16:40 ` [Bug c++/25156] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: joerg dot richter at pdv-fs dot de @ 2005-11-29 16:12 UTC (permalink / raw)
  To: gcc-bugs

bool func()
{
  return;
}

a.cc:3: error: return-statement with no value, in function returning 'int'


-- 
           Summary: wrong error message (int instead of bool)
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de


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


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

* [Bug c++/25156] [3.4/4.0/4.1 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
@ 2005-11-29 16:40 ` pinskia at gcc dot gnu dot org
  2005-11-29 16:46 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-29 16:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-29 16:40 -------
Confirmed, all an integer types give the wrong error (well except for int).
3.3 gave:
t.c: In function `bool func()':
t.c:3: error: return-statement with no value, in function declared with a 
   non-void return type


So this is a regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |3.4.0 4.0.0 4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-11-29 16:40:35
               date|                            |
            Summary|wrong error message (int    |[3.4/4.0/4.1 Regression]
                   |instead of bool)            |wrong error message (int
                   |                            |instead of bool)
   Target Milestone|---                         |4.0.3


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


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

* [Bug c++/25156] [3.4/4.0/4.1 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
  2005-11-29 16:40 ` [Bug c++/25156] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-11-29 16:46 ` pinskia at gcc dot gnu dot org
  2005-11-29 17:48 ` gdr at integrable-solutions dot net
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-29 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-11-29 16:46 -------
Hmm, it is looking at the wrong type, it is looking at the RESULT_DECL's type
instead of the FUNCTION_TYPE's type which has the correct type, I might fix
this later tonight.


-- 


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


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

* [Bug c++/25156] [3.4/4.0/4.1 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
  2005-11-29 16:40 ` [Bug c++/25156] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-11-29 16:46 ` pinskia at gcc dot gnu dot org
@ 2005-11-29 17:48 ` gdr at integrable-solutions dot net
  2005-11-29 18:02 ` gdr at integrable-solutions dot net
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-11-29 17:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gdr at integrable-solutions dot net  2005-11-29 17:48 -------
Subject: Re:  [3.4/4.0/4.1 Regression] wrong error message (int instead of
bool)

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Hmm, it is looking at the wrong type, it is looking at the RESULT_DECL's type
| instead of the FUNCTION_TYPE's type which has the correct type, I might fix
| this later tonight.

That is a combination of two things:
  (1) vestige of the old infamous named-returned value extension logic;
  (2) the default widening-strategy used in the compiler.

-- Gaby


-- 


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


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

* [Bug c++/25156] [3.4/4.0/4.1 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (2 preceding siblings ...)
  2005-11-29 17:48 ` gdr at integrable-solutions dot net
@ 2005-11-29 18:02 ` gdr at integrable-solutions dot net
  2005-11-29 20:37 ` gdr at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-11-29 18:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from gdr at integrable-solutions dot net  2005-11-29 18:02 -------
Subject: Re:  [3.4/4.0/4.1 Regression] wrong error message (int instead of
bool)

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Hmm, it is looking at the wrong type, it is looking at the RESULT_DECL's type
| instead of the FUNCTION_TYPE's type which has the correct type, I might fix
| this later tonight.

Try this

*** ChangeLog   (revision 107674)
--- ChangeLog   (local)
***************
*** 1,3 ****
--- 1,10 ----
+ 2005-11-29  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+ 
+       PR c++/25156
+       * typeck.c (check_return_expr): Get the return-type from the
+       function declaration, now that the named-return value extension is
+       no longer existent.
+ 
  2005-11-30  Ben Elliston  <bje@au.ibm.com>

        * typeck.c (build_x_unary_op): Correct spelling in error message.
*** typeck.c    (revision 107674)
--- typeck.c    (local)
*************** check_return_expr (tree retval, bool *no
*** 6257,6270 ****
        return retval;
      }

!   /* When no explicit return-value is given in a function with a named
!      return value, the named return value is used.  */
!   result = DECL_RESULT (current_function_decl);
!   valtype = TREE_TYPE (result);
    gcc_assert (valtype != NULL_TREE);
    fn_returns_value_p = !VOID_TYPE_P (valtype);
-   if (!retval && DECL_NAME (result) && fn_returns_value_p)
-     retval = result;

    /* Check for a return statement with no return value in a function
       that's supposed to return a value.  */
--- 6257,6269 ----
        return retval;
      }

!   /* We no longer support the old "named-return value" extension, so get
!      the return-type from the function declaration.  */
!   valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
    gcc_assert (valtype != NULL_TREE);
+   result = DECL_RESULT (current_function_decl);
+   gcc_assert (TREE_TYPE (result) != 0);
    fn_returns_value_p = !VOID_TYPE_P (valtype);

    /* Check for a return statement with no return value in a function
       that's supposed to return a value.  */


-- 


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


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

* [Bug c++/25156] [3.4/4.0/4.1 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (3 preceding siblings ...)
  2005-11-29 18:02 ` gdr at integrable-solutions dot net
@ 2005-11-29 20:37 ` gdr at gcc dot gnu dot org
  2005-12-04  5:00 ` [Bug c++/25156] [3.4/4.0/4.1/4.2 " gdr at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-11-29 20:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from gdr at gcc dot gnu dot org  2005-11-29 20:37 -------
(In reply to comment #4)

> | instead of the FUNCTION_TYPE's type which has the correct type, I might fix
> | this later tonight.
> 
> Try this

this patch is incomplete.


-- 

gdr at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/25156] [3.4/4.0/4.1/4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (4 preceding siblings ...)
  2005-11-29 20:37 ` gdr at gcc dot gnu dot org
@ 2005-12-04  5:00 ` gdr at gcc dot gnu dot org
  2005-12-19 18:44 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-12-04  5:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2005-12-04 05:00 -------
Working on a patch.
Fixing this issue has a deep "type" implications on the way we currently
hand inputs with erronous types whereas trying to progress as much as possible.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |gdr at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-11-29 16:40:35         |2005-12-04 05:00:09
               date|                            |


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


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

* [Bug c++/25156] [3.4/4.0/4.1/4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (5 preceding siblings ...)
  2005-12-04  5:00 ` [Bug c++/25156] [3.4/4.0/4.1/4.2 " gdr at gcc dot gnu dot org
@ 2005-12-19 18:44 ` mmitchel at gcc dot gnu dot org
  2006-02-14 18:30 ` amylaar at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-12-19 18:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mmitchel at gcc dot gnu dot org  2005-12-19 18:44 -------
A minor diagnostic issue: P5.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5


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


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

* [Bug c++/25156] [3.4/4.0/4.1/4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (6 preceding siblings ...)
  2005-12-19 18:44 ` mmitchel at gcc dot gnu dot org
@ 2006-02-14 18:30 ` amylaar at gcc dot gnu dot org
  2006-03-11  3:22 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2006-02-14 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from amylaar at gcc dot gnu dot org  2006-02-14 18:30 -------
(In reply to comment #6)
> Working on a patch.
> Fixing this issue has a deep "type" implications on the way we currently
> hand inputs with erronous types whereas trying to progress as much as possible.
> 
Are you still working on this?  If this is too hard to handle exactly, could
we instead do something similar to 3.3, i.e. instead of 'int' we say non-void
type or integer type?


-- 


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


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

* [Bug c++/25156] [3.4/4.0/4.1/4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (7 preceding siblings ...)
  2006-02-14 18:30 ` amylaar at gcc dot gnu dot org
@ 2006-03-11  3:22 ` mmitchel at gcc dot gnu dot org
  2007-01-25 16:04 ` [Bug c++/25156] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-03-11  3:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/25156] [4.0/4.1/4.2/4.3 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (8 preceding siblings ...)
  2006-03-11  3:22 ` mmitchel at gcc dot gnu dot org
@ 2007-01-25 16:04 ` gdr at gcc dot gnu dot org
  2007-02-07 22:53 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-01-25 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from gdr at gcc dot gnu dot org  2007-01-25 16:04 -------
Adjusting milestone


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |4.1.3


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


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

* [Bug c++/25156] [4.0/4.1/4.2/4.3 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (9 preceding siblings ...)
  2007-01-25 16:04 ` [Bug c++/25156] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
@ 2007-02-07 22:53 ` pinskia at gcc dot gnu dot org
  2007-02-14  9:36 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-07 22:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |4.1.2


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


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

* [Bug c++/25156] [4.0/4.1/4.2/4.3 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (10 preceding siblings ...)
  2007-02-07 22:53 ` pinskia at gcc dot gnu dot org
@ 2007-02-14  9:36 ` mmitchel at gcc dot gnu dot org
  2007-08-14 10:05 ` [Bug c++/25156] [4.0/4.1/4.2 " pcarlini at suse dot de
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug c++/25156] [4.0/4.1/4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (11 preceding siblings ...)
  2007-02-14  9:36 ` mmitchel at gcc dot gnu dot org
@ 2007-08-14 10:05 ` pcarlini at suse dot de
  2008-07-04 20:15 ` [Bug c++/25156] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 15:48 ` jsm28 at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2007-08-14 10:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pcarlini at suse dot de  2007-08-14 10:04 -------
Apparently this is fixed in mainline.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.0/4.1/4.2 Regression]
                   |wrong error message (int    |wrong error message (int
                   |instead of bool)            |instead of bool)


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


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

* [Bug c++/25156] [4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (12 preceding siblings ...)
  2007-08-14 10:05 ` [Bug c++/25156] [4.0/4.1/4.2 " pcarlini at suse dot de
@ 2008-07-04 20:15 ` jsm28 at gcc dot gnu dot org
  2009-03-30 15:48 ` jsm28 at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 20:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jsm28 at gcc dot gnu dot org  2008-07-04 20:14 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression] wrong  |[4.2 Regression] wrong error
                   |error message (int instead  |message (int instead of
                   |of bool)                    |bool)
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/25156] [4.2 Regression] wrong error message (int instead of bool)
  2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
                   ` (13 preceding siblings ...)
  2008-07-04 20:15 ` [Bug c++/25156] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 15:48 ` jsm28 at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jsm28 at gcc dot gnu dot org  2009-03-30 15:47 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|3.4.0 4.0.0 4.0.4 4.1.0     |3.4.0 4.0.0 4.0.4 4.1.0
                   |                            |4.2.5
      Known to work|                            |4.3.0
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 15:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29 16:12 [Bug c++/25156] New: wrong error message (int instead of bool) joerg dot richter at pdv-fs dot de
2005-11-29 16:40 ` [Bug c++/25156] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-11-29 16:46 ` pinskia at gcc dot gnu dot org
2005-11-29 17:48 ` gdr at integrable-solutions dot net
2005-11-29 18:02 ` gdr at integrable-solutions dot net
2005-11-29 20:37 ` gdr at gcc dot gnu dot org
2005-12-04  5:00 ` [Bug c++/25156] [3.4/4.0/4.1/4.2 " gdr at gcc dot gnu dot org
2005-12-19 18:44 ` mmitchel at gcc dot gnu dot org
2006-02-14 18:30 ` amylaar at gcc dot gnu dot org
2006-03-11  3:22 ` mmitchel at gcc dot gnu dot org
2007-01-25 16:04 ` [Bug c++/25156] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-02-07 22:53 ` pinskia at gcc dot gnu dot org
2007-02-14  9:36 ` mmitchel at gcc dot gnu dot org
2007-08-14 10:05 ` [Bug c++/25156] [4.0/4.1/4.2 " pcarlini at suse dot de
2008-07-04 20:15 ` [Bug c++/25156] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 15:48 ` jsm28 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).