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: unassig...@gcc.gnu.org
        ReportedBy: fo...@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.)

Reply via email to