Hello there,

For the following source code, g++ 343 appears unable to detect that
local variable b is set but not used.

void g( int );

void f( int a)
{
        int b;

        if (a < 0)
        {
                b = 1;
        }
        else
        {
                b = 2;
        }
        g( a);
}

[EMAIL PROTECTED] src]$ ~/gnu/gcc343/results/bin/g++ -g -O2 -Wall -W -c 
unused.cc
[EMAIL PROTECTED] src]$

Here is Intel C++ 8.1 doing what I want.

unused.cc(6): remark #593: variable "b" was set but never used
        int b;
            ^

-- 
           Summary: g++ 343 cannot detect local variable set but never used
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to