* [Bug c++/20681] [4.3/4.4/4.5/4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
@ 2011-02-23 22:13 ` pinskia at gcc dot gnu.org
2011-02-24 0:59 ` ami at fischman dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-02-23 22:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ami at fischman dot org
--- Comment #28 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-23 22:08:42 UTC ---
*** Bug 47864 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.3/4.4/4.5/4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
2011-02-23 22:13 ` [Bug c++/20681] [4.3/4.4/4.5/4.6 Regression] wrong "control reaches" warning with switches pinskia at gcc dot gnu.org
@ 2011-02-24 0:59 ` ami at fischman dot org
2011-06-27 13:45 ` [Bug c++/20681] [4.3/4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: ami at fischman dot org @ 2011-02-24 0:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
--- Comment #29 from Ami Fischman <ami at fischman dot org> 2011-02-23 23:35:45 UTC ---
Further reduced test case from dup bug 47864:
$ nl t.cc ; g++ -finstrument-functions -Wreturn-type -Werror -c t.cc
1 int foo(int type) {
2 switch(type) {
3 case 0: return 1; break;
4 default: return 0;
5 }
6 }
cc1plus: warnings being treated as errors
t.cc: In function ‘int foo(int)’:
t.cc:6: error: control reaches end of non-void function
(in 4.4.3)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.3/4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
2011-02-23 22:13 ` [Bug c++/20681] [4.3/4.4/4.5/4.6 Regression] wrong "control reaches" warning with switches pinskia at gcc dot gnu.org
2011-02-24 0:59 ` ami at fischman dot org
@ 2011-06-27 13:45 ` rguenth at gcc dot gnu.org
2011-11-15 14:20 ` [Bug c++/20681] [4.4/4.5/4.6/4.7 " dimhen at gmail dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 13:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.6 |4.4.7
--- Comment #30 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 12:13:05 UTC ---
4.3 branch is being closed, moving to 4.4.7 target.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-06-27 13:45 ` [Bug c++/20681] [4.3/4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
@ 2011-11-15 14:20 ` dimhen at gmail dot com
2011-11-15 15:21 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: dimhen at gmail dot com @ 2011-11-15 14:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
--- Comment #31 from Dmitry G. Dyachenko <dimhen at gmail dot com> 2011-11-15 14:10:33 UTC ---
gcc -Wreturn-type -c r.c
r.c: In function 'bar':
r.c:8:1: warning: control reaches end of non-void function [-Wreturn-type]
enum foo { e_1 };
int bar(enum foo x)
{
switch(x) {
case e_1:
return 0;
}
}
gcc version 4.7.0 20111115 (experimental) [trunk revision 181378] (GCC)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-11-15 14:20 ` [Bug c++/20681] [4.4/4.5/4.6/4.7 " dimhen at gmail dot com
@ 2011-11-15 15:21 ` redi at gcc dot gnu.org
2011-11-16 9:28 ` dimhen at gmail dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-11-15 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
--- Comment #32 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-15 14:53:13 UTC ---
(In reply to comment #31)
> gcc -Wreturn-type -c r.c
> r.c: In function 'bar':
> r.c:8:1: warning: control reaches end of non-void function [-Wreturn-type]
>
> enum foo { e_1 };
> int bar(enum foo x)
> {
> switch(x) {
> case e_1:
> return 0;
> }
> }
Not a bug, enum foo can have other values except e_1.
What happens if you call bar( (foo)1 ) ?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2011-11-15 15:21 ` redi at gcc dot gnu.org
@ 2011-11-16 9:28 ` dimhen at gmail dot com
2012-01-13 19:48 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: dimhen at gmail dot com @ 2011-11-16 9:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
--- Comment #33 from Dmitry G. Dyachenko <dimhen at gmail dot com> 2011-11-16 09:04:40 UTC ---
> Not a bug, enum foo can have other values except e_1.
>
> What happens if you call bar( (foo)1 ) ?
sorry for noise :(
You are right - no error in c#31
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2011-11-16 9:28 ` dimhen at gmail dot com
@ 2012-01-13 19:48 ` jason at gcc dot gnu.org
2012-01-13 20:20 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 19:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6/4.7 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2012-01-13 19:48 ` jason at gcc dot gnu.org
@ 2012-01-13 20:20 ` jason at gcc dot gnu.org
2012-01-13 20:22 ` [Bug c++/20681] [4.4/4.5/4.6 " jason at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 20:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
--- Comment #34 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 20:06:25 UTC ---
Author: jason
Date: Fri Jan 13 20:06:16 2012
New Revision: 183161
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183161
Log:
PR c++/20681
* semantics.c (finish_break_stmt): Avoid adding an unreachable
BREAK_STMT.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wreturn-type-7.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.4/4.5/4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2012-01-13 20:20 ` jason at gcc dot gnu.org
@ 2012-01-13 20:22 ` jason at gcc dot gnu.org
2012-03-13 13:41 ` [Bug c++/20681] [4.5/4.6 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 20:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.7.0
Summary|[4.4/4.5/4.6/4.7 |[4.4/4.5/4.6 Regression]
|Regression] wrong "control |wrong "control reaches"
|reaches" warning with |warning with switches
|switches |
--- Comment #35 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 20:17:50 UTC ---
Fixed for 4.7. Could backport if there's interest.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.5/4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2012-01-13 20:22 ` [Bug c++/20681] [4.4/4.5/4.6 " jason at gcc dot gnu.org
@ 2012-03-13 13:41 ` jakub at gcc dot gnu.org
2012-07-02 13:34 ` [Bug c++/20681] [4.6 " rguenth at gcc dot gnu.org
2012-10-15 23:53 ` paolo.carlini at oracle dot com
11 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 13:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.7 |4.5.4
--- Comment #36 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 12:45:56 UTC ---
4.4 branch is being closed, moving to 4.5.4 target.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2012-03-13 13:41 ` [Bug c++/20681] [4.5/4.6 " jakub at gcc dot gnu.org
@ 2012-07-02 13:34 ` rguenth at gcc dot gnu.org
2012-10-15 23:53 ` paolo.carlini at oracle dot com
11 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02 13:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.5.4 |4.6.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/20681] [4.6 Regression] wrong "control reaches" warning with switches
[not found] <bug-20681-4@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2012-07-02 13:34 ` [Bug c++/20681] [4.6 " rguenth at gcc dot gnu.org
@ 2012-10-15 23:53 ` paolo.carlini at oracle dot com
11 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-15 23:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
CC|gcc-bugs at gcc dot gnu.org |
Resolution| |FIXED
Target Milestone|4.6.4 |4.7.0
--- Comment #37 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-15 23:53:18 UTC ---
Closing as fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread