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++/16517] New: warn about unused assignment


It would be nice if the compiler could warn about useless assigments:

void foo()
{
   int x;
   x=42;
}

Here x seems to be "used", although it is never read. gcc does warn if x is 
intialized at declaraton (s/;x=/=)

Tested with g++ -O3 -W -Wall and gcc -O3 -W -Wall,
gcc version 3.5.0 20040711 (experimental)

-- 
           Summary: warn about unused assignment
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tneumann at pi3 dot informatik dot uni-mannheim dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16517


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