public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
@ 2011-02-17 14:32 dev.lists at jessamine dot co.uk
2011-02-17 14:56 ` [Bug c++/47783] [4.6 Regression] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dev.lists at jessamine dot co.uk @ 2011-02-17 14:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Summary: Warning 'set but not used'
[-Wunused-but-set-parameter] incorrectly issued for
update through reference wrapper
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dev.lists@jessamine.co.uk
Compiling the following program with warning options -W -Wall yields
<stdin>: In function ‘void f(ref_wrapper)’:
<stdin>:6:6: warning: parameter ‘ref’ set but not used
[-Wunused-but-set-parameter]
If the reference-to-int is replaced with a pointer-to-int and dereference and
address-of operators are used in the appropriate places the warning does not
occur.
In all cases and at all optimization levels the resulting program returns 7 as
expected.
struct ref_wrapper
{
int& i;
};
void f( ref_wrapper ref )
{
ref.i = 7;
}
int main()
{
int x = 1;
ref_wrapper xref = {x};
f(xref);
return x;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
@ 2011-02-17 14:56 ` redi at gcc dot gnu.org
2011-02-17 15:39 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-02-17 14:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.02.17 14:32:03
Summary|Warning 'set but not used' |[4.6 Regression] Warning
|[-Wunused-but-set-parameter |'set but not used'
|] incorrectly issued for |[-Wunused-but-set-parameter
|update through reference |] incorrectly issued for
|wrapper |update through reference
| |wrapper
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-17 14:32:03 UTC ---
confirmed - no warning with 4.4 or 4.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
2011-02-17 14:56 ` [Bug c++/47783] [4.6 Regression] " redi at gcc dot gnu.org
@ 2011-02-17 15:39 ` rguenth at gcc dot gnu.org
2011-02-17 15:50 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-17 15:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
2011-02-17 14:56 ` [Bug c++/47783] [4.6 Regression] " redi at gcc dot gnu.org
2011-02-17 15:39 ` rguenth at gcc dot gnu.org
@ 2011-02-17 15:50 ` paolo.carlini at oracle dot com
2011-02-17 17:56 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-02-17 15:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-02-17 15:39:13 UTC ---
Let's CC Jakub...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
` (2 preceding siblings ...)
2011-02-17 15:50 ` paolo.carlini at oracle dot com
@ 2011-02-17 17:56 ` jakub at gcc dot gnu.org
2011-02-17 20:49 ` jakub at gcc dot gnu.org
2011-02-17 20:53 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-17 17:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-17 17:13:45 UTC ---
Created attachment 23388
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23388
gcc46-pr47783.patch
Untested fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
` (3 preceding siblings ...)
2011-02-17 17:56 ` jakub at gcc dot gnu.org
@ 2011-02-17 20:49 ` jakub at gcc dot gnu.org
2011-02-17 20:53 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-17 20:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-17 20:44:16 UTC ---
Author: jakub
Date: Thu Feb 17 20:44:14 2011
New Revision: 170255
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170255
Log:
PR c++/47783
* cvt.c (convert_from_reference): Call mark_exp_read.
* g++.dg/warn/Wunused-parm-4.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wunused-parm-4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cvt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/47783] [4.6 Regression] Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
` (4 preceding siblings ...)
2011-02-17 20:49 ` jakub at gcc dot gnu.org
@ 2011-02-17 20:53 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-17 20:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47783
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-17 20:48:05 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-02-17 20:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17 14:32 [Bug c++/47783] New: Warning 'set but not used' [-Wunused-but-set-parameter] incorrectly issued for update through reference wrapper dev.lists at jessamine dot co.uk
2011-02-17 14:56 ` [Bug c++/47783] [4.6 Regression] " redi at gcc dot gnu.org
2011-02-17 15:39 ` rguenth at gcc dot gnu.org
2011-02-17 15:50 ` paolo.carlini at oracle dot com
2011-02-17 17:56 ` jakub at gcc dot gnu.org
2011-02-17 20:49 ` jakub at gcc dot gnu.org
2011-02-17 20:53 ` jakub 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).