<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - false positive with -Warray-bounds when compiling wine (dlls/kernel32/file.c)"
href="http://llvm.org/bugs/show_bug.cgi?id=16217">16217</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>false positive with -Warray-bounds when compiling wine (dlls/kernel32/file.c)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>austinenglish@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>austin@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@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@debian-home:~/src/wine-clang/dlls/kernel32$ echo $?
0
austin@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@debian-home:~/src/wine-clang/dlls/kernel32$ echo $?
0
gcc has no issue with that file:
austin@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@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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>