[llvm-bugs] [Bug 33068] New: -Wunneeded-internal-declaration disregards sizeof(x)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 17 05:34:58 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33068

            Bug ID: 33068
           Summary: -Wunneeded-internal-declaration disregards sizeof(x)
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stefan at bytereef.org
                CC: llvm-bugs at lists.llvm.org

$ clang --version
Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on
LLVM 3.6.0)
Target: x86_64-pc-linux-gnu
Thread model: posix


$ cat test.c 
static int x = 10;
int
main(void)
{
    return sizeof(x) == 4;
}


$ clang -Wall -Wextra -Werror -o test test.c
test.c:1:12: error: variable 'x' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static int x = 10;
           ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170517/c26f12e6/attachment.html>


More information about the llvm-bugs mailing list