This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/69723] pre-post-increment/decrement and reading the same variable that is assigned should not be considered uses for Wunused-but-set-variable
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Feb 2016 01:17:38 +0000
- Subject: [Bug c++/69723] pre-post-increment/decrement and reading the same variable that is assigned should not be considered uses for Wunused-but-set-variable
- Auto-submitted: auto-generated
- References: <bug-69723-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69723
Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
Summary|Inconsistent report of |pre-post-increment/decremen
|unused and uninitialized |t and reading the same
|variables |variable that is assigned
| |should not be considered
| |uses for
| |Wunused-but-set-variable
Severity|trivial |normal
--- Comment #6 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Peter VARGA from comment #5)
> I do not understand what you mean with "Replace unused++ with unused =
> unused + 1".
>
> How ever. I checked my example code in Compiler Explorer with clang and
> clang generates a warning as it should be.
Only for the -Wuninitialized (which GCC warns with -O1). Clang doesn't even
catch
void foo() {
int unused;
unused=0;
}
*** This bug has been marked as a duplicate of bug 44677 ***