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/46015] New: -Wunused-but-set-variable false positive


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

           Summary: -Wunused-but-set-variable false positive
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: foldy@rmki.kfki.hu


/* test.c */

int f(int i)
{
  static void* labs[2] =
    { &&lab1,
      &&lab2
    };

  goto *(labs[i&1]);

 lab1: return 1;
 lab2: return 2;

  return 0;
}

/* test.c end */

GCC 4.6.0 20101014 -Wall prints the followiung warning:

test.c: In function 'f':
test.c:5:16: warning: variable 'labs' set but not used
[-Wunused-but-set-variable]

(GCC 4.5.1 is OK.)


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