public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64383] New: missed warning for unused variable.
@ 2014-12-23 12:40 pluto at agmk dot net
2014-12-23 20:44 ` [Bug c++/64383] " manu at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: pluto at agmk dot net @ 2014-12-23 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
Bug ID: 64383
Summary: missed warning for unused variable.
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pluto at agmk dot net
#include <memory>
#include <vector>
int main()
{
std::vector< std::shared_ptr< int > > v1;
v1.push_back( std::make_shared< int >( 7 ) );
for( auto p : v1 )
{
}
std::vector< int > v2;
v2.push_back( 7 );
for( auto i : v2 )
{
}
}
the 'p' variable is not reported as unused.
% LANG=C g++ -Wall -g2 t.cpp -o t -std=c++1y
t.cpp: In function 'int main()':
t.cpp:13:15: warning: unused variable 'i' [-Wunused-variable]
for( auto i : v2 )
^
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
@ 2014-12-23 20:44 ` manu at gcc dot gnu.org
2015-01-12 12:02 ` pluto at agmk dot net
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu.org @ 2014-12-23 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |manu at gcc dot gnu.org
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
A minimized testcase would be helpful. Using delta would probably remove
already a lot: https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
>From gcc-bugs-return-471668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 23 20:55:35 2014
Return-Path: <gcc-bugs-return-471668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15693 invoked by alias); 23 Dec 2014 20:55:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 15669 invoked by uid 48); 23 Dec 2014 20:55:31 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/64396] Missed optimization in post-loop register handling
Date: Tue, 23 Dec 2014 20:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64396-4-8TRno2tHgb@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64396-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64396-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg02675.txt.bz2
Content-length: 374
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd396
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The reason is GCC tries to be smart of calculating s4 outside of the loop
because the iv that might be selected is not related at all to s4. That is it
might do:
int limit = es4-s4;
int i = 0;
for(i=0;i<limit;i++) {
add_carry32(sum, *s4[i]);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
2014-12-23 20:44 ` [Bug c++/64383] " manu at gcc dot gnu.org
@ 2015-01-12 12:02 ` pluto at agmk dot net
2015-01-20 11:55 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pluto at agmk dot net @ 2015-01-12 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
--- Comment #2 from Pawel Sikora <pluto at agmk dot net> ---
(In reply to Manuel López-Ibáñez from comment #1)
> A minimized testcase would be helpful. Using delta would probably remove
> already a lot: https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
one more small testcase w/o stl with missed warning.
struct Y
{
~Y(); // comment this line to get proper warning about 'unused y variable'
};
struct X
{
static Y& get();
};
int main()
{
Y& y = X::get();
}
clang 3.5.0 warns in both (w/ and w/o Y dtor) variants.
>From gcc-bugs-return-472796-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jan 12 12:07:34 2015
Return-Path: <gcc-bugs-return-472796-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18674 invoked by alias); 12 Jan 2015 12:07:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18636 invoked by uid 48); 12 Jan 2015 12:07:25 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64383] missed warning for unused variable.
Date: Mon, 12 Jan 2015 12:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-64383-4-gBMQlOZLn4@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64383-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64383-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00790.txt.bz2
Content-length: 593
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd383
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
clang generally doesn't care about false positives.
And, the variable can be present just so that the dtor action is performed on
it (similarly to how other variables are there just to perform the ctor action
on it).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
2014-12-23 20:44 ` [Bug c++/64383] " manu at gcc dot gnu.org
2015-01-12 12:02 ` pluto at agmk dot net
@ 2015-01-20 11:55 ` jakub at gcc dot gnu.org
2015-01-20 13:51 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-20 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On the #c2 testcase, gcc trunk now warns, starting with r217957.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
` (2 preceding siblings ...)
2015-01-20 11:55 ` jakub at gcc dot gnu.org
@ 2015-01-20 13:51 ` paolo.carlini at oracle dot com
2015-01-20 14:20 ` paolo at gcc dot gnu.org
2015-01-20 14:21 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-01-20 13:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Yes, this is already fixed by the patch for c++/63657. The testcases are
slightly different thus I'm going to add the reduced testcase before closing
the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
` (3 preceding siblings ...)
2015-01-20 13:51 ` paolo.carlini at oracle dot com
@ 2015-01-20 14:20 ` paolo at gcc dot gnu.org
2015-01-20 14:21 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-01-20 14:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Jan 20 14:19:32 2015
New Revision: 219896
URL: https://gcc.gnu.org/viewcvs?rev=219896&root=gcc&view=rev
Log:
2015-01-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64383
* g++.dg/warn/Wunused-var-23.C: New.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wunused-var-23.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64383] missed warning for unused variable.
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
` (4 preceding siblings ...)
2015-01-20 14:20 ` paolo at gcc dot gnu.org
@ 2015-01-20 14:21 ` paolo.carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-01-20 14:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC|paolo.carlini at oracle dot com |
Resolution|--- |FIXED
Target Milestone|--- |4.9.3
--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-20 14:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 12:40 [Bug c++/64383] New: missed warning for unused variable pluto at agmk dot net
2014-12-23 20:44 ` [Bug c++/64383] " manu at gcc dot gnu.org
2015-01-12 12:02 ` pluto at agmk dot net
2015-01-20 11:55 ` jakub at gcc dot gnu.org
2015-01-20 13:51 ` paolo.carlini at oracle dot com
2015-01-20 14:20 ` paolo at gcc dot gnu.org
2015-01-20 14:21 ` paolo.carlini at oracle 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).