[LLVMbugs] [Bug 16217] New: false positive with -Warray-bounds when compiling wine (dlls/kernel32/file.c)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 3 22:42:59 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16217

            Bug ID: 16217
           Summary: false positive with -Warray-bounds when compiling wine
                    (dlls/kernel32/file.c)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: austinenglish at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

austin at debian-home:~/src/wine-clang/dlls/kernel32$ clang -c -I. -I.
-I../../include -I../../include  -D__WINESRC__ -D_KERNEL32_ -D_NORMALIZE_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers
-Wstrict-prototypes -Wtype-limits -Wwrite-strings -gdwarf-2 -gstrict-dwarf
-fno-omit-frame-pointer -Wpointer-arith -I/usr/include/freetype2    --std=gnu89
-g -O2 -Warray-bounds -o file.o file.c
file.c:2034:49: warning: array index 1 is past the end of the array (which
contains 1 element) [-Warray-bounds]                dir_info->FileName[0] ==
'.' && dir_info->FileName[1] == '.') continue;
                                                ^                  ~
../../include/winternl.h:487:5: note: array 'FileName' declared here
    WCHAR               FileName[ANYSIZE_ARRAY];
    ^
1 warning generated.

what's interesting is that if I preprocess the file and recompile, the warning
goes away:
austin at debian-home:~/src/wine-clang/dlls/kernel32$ clang -E -I. -I.
-I../../include -I../../include  -D__WINESRC__ -D_KERNEL32_ -D_NORMALIZE_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers
-Wstrict-prototypes -Wtype-limits -Wwrite-strings -gdwarf-2 -gstrict-dwarf
-fno-omit-frame-pointer -Wpointer-arith -I/usr/include/freetype2    --std=gnu89
-g -O2 -Warray-bounds -o file.i file.c
austin at debian-home:~/src/wine-clang/dlls/kernel32$ echo $?
0
austin at debian-home:~/src/wine-clang/dlls/kernel32$ clang -c -I. -I.
-I../../include -I../../include  -D__WINESRC__ -D_KERNEL32_ -D_NORMALIZE_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers
-Wstrict-prototypes -Wtype-limits -Wwrite-strings -gdwarf-2 -gstrict-dwarf
-fno-omit-frame-pointer -Wpointer-arith -I/usr/include/freetype2    --std=gnu89
-g -O2 -Warray-bounds -o file.o file.i
clang: warning: argument unused during compilation: '-I .'
clang: warning: argument unused during compilation: '-I .'
clang: warning: argument unused during compilation: '-I ../../include'
clang: warning: argument unused during compilation: '-I ../../include'
clang: warning: argument unused during compilation: '-I /usr/include/freetype2'
austin at debian-home:~/src/wine-clang/dlls/kernel32$ echo $?
0

gcc has no issue with that file:
austin at debian-home:~/src/wine-clang/dlls/kernel32$ gcc -c -I. -I.
-I../../include -I../../include  -D__WINESRC__ -D_KERNEL32_ -D_NORMALIZE_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers
-Wstrict-prototypes -Wtype-limits -Wwrite-strings -gdwarf-2 -gstrict-dwarf
-fno-omit-frame-pointer -Wpointer-arith -I/usr/include/freetype2    --std=gnu89
-g -O2 -Warray-bounds -o file.o file.c
austin at debian-home:~/src/wine-clang/dlls/kernel32$ echo $?
0

clang version 3.3 (git://github.com/llvm-mirror/clang.git
3283fc52f370fb8c99d0936e2bd8283d02ec0720)
(git://github.com/llvm-mirror/llvm.git
00c5c5d46731834caa0ca3280e0dcc43202dd3c8)
Target: i386-pc-linux-gnu
Thread model: posix

wine-1.5.31

-- 
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/20130604/79b83fd4/attachment.html>


More information about the llvm-bugs mailing list