public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar
@ 2012-10-15 7:49 redi at gcc dot gnu.org
2012-10-15 10:09 ` [Bug c++/54930] " redi at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-15 7:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
Bug #: 54930
Summary: Add warning switch for "returning reference to
temporary" and similar
Classification: Unclassified
Product: gcc
Version: 4.6.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
The various warnings issued by maybe_warn_about_returning_address_of_local()
are enabled by default, so there is no way to make them (and only them) into
errors.
If they were controlled by a switch such as -Wreturn-local-addr (enabled by
default) then they could be promoted to an error with -Werror=return-local-addr
(or disabled with -Wno-return-local-addr for the foolish.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
@ 2012-10-15 10:09 ` redi at gcc dot gnu.org
2012-10-15 10:11 ` paolo.carlini at oracle dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-15 10:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-15 10:09:01 UTC ---
Created attachment 28448
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28448
add -Wreturn-local-addr switch
This bootstraps, I'll regtest it tonight
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
2012-10-15 10:09 ` [Bug c++/54930] " redi at gcc dot gnu.org
@ 2012-10-15 10:11 ` paolo.carlini at oracle dot com
2012-10-15 10:24 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-15 10:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-15 10:11:15 UTC ---
Great. Remember the docs.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
2012-10-15 10:09 ` [Bug c++/54930] " redi at gcc dot gnu.org
2012-10-15 10:11 ` paolo.carlini at oracle dot com
@ 2012-10-15 10:24 ` redi at gcc dot gnu.org
2012-10-15 23:45 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-15 10:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-15 10:24:14 UTC ---
Yep, and tests :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
` (2 preceding siblings ...)
2012-10-15 10:24 ` redi at gcc dot gnu.org
@ 2012-10-15 23:45 ` paolo.carlini at oracle dot com
2012-10-18 18:31 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-15 23:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-10-15
AssignedTo|unassigned at gcc dot |redi at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.8.0
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
` (3 preceding siblings ...)
2012-10-15 23:45 ` paolo.carlini at oracle dot com
@ 2012-10-18 18:31 ` redi at gcc dot gnu.org
2012-10-29 23:22 ` redi at gcc dot gnu.org
2012-10-29 23:23 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-18 18:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-18 18:30:40 UTC ---
patch posted for review http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01737.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
` (4 preceding siblings ...)
2012-10-18 18:31 ` redi at gcc dot gnu.org
@ 2012-10-29 23:22 ` redi at gcc dot gnu.org
2012-10-29 23:23 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-29 23:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-29 23:21:42 UTC ---
Author: redi
Date: Mon Oct 29 23:21:35 2012
New Revision: 192968
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192968
Log:
gcc/c-family:
PR c++/54930
* c.opt (Wreturn_local_addr): Define new option.
gcc/c:
PR c++/54930
* c-typeck.c (c_finish_return): Use OPT_Wreturn_local_addr.
gcc/cp:
PR c++/54930
* typeck.c (maybe_warn_about_returning_address_of_local): Use
OPT_Wreturn_local_addr.
gcc:
PR c++/54930
* doc/invoke.texi (Warning Options): Document -Wno-return-local-addr.
gcc/testsuite:
PR c++/54930
* gcc.dg/Wreturn-local-addr.c: New.
* g++.dg/warn/Wno-return-local-addr.C: New.
* g++.dg/warn/Wreturn-local-addr.C: New.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wno-return-local-addr.C
trunk/gcc/testsuite/g++.dg/warn/Wreturn-local-addr.C
trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/54930] Add warning switch for "returning reference to temporary" and similar
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
` (5 preceding siblings ...)
2012-10-29 23:22 ` redi at gcc dot gnu.org
@ 2012-10-29 23:23 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-29 23:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-29 23:22:51 UTC ---
fixed for 4.8.0
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-10-29 23:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 7:49 [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar redi at gcc dot gnu.org
2012-10-15 10:09 ` [Bug c++/54930] " redi at gcc dot gnu.org
2012-10-15 10:11 ` paolo.carlini at oracle dot com
2012-10-15 10:24 ` redi at gcc dot gnu.org
2012-10-15 23:45 ` paolo.carlini at oracle dot com
2012-10-18 18:31 ` redi at gcc dot gnu.org
2012-10-29 23:22 ` redi at gcc dot gnu.org
2012-10-29 23:23 ` redi 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).