[Bug c/43981] New: -Wunused-but-set-variable does not consider array sizing use of a variable

gerald at pfeifer dot com gcc-bugzilla@gcc.gnu.org
Tue May 4 08:59:00 GMT 2010


This simple program

  void g(char*);

  char f(unsigned a) {
    unsigned len=a*3; 
    char t[len];

    g(t);
    return t[0];
  }

issues "warning: variable 'len' set but not used" even though len 
appears in char t[len];


-- 
           Summary: -Wunused-but-set-variable does not consider array sizing
                    use of a variable
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gerald at pfeifer dot com


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



More information about the Gcc-bugs mailing list