This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


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 ***

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]