<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Clang warning extending into system headers (-Werror,-Wsign-compare)"
href="https://bugs.llvm.org/show_bug.cgi?id=38881">38881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang warning extending into system headers (-Werror,-Wsign-compare)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</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>raj.khem@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Attached example when compiled with clang for linux/musl systems emits a
warnings in system headers
Testcase
=============================
#define _GNU_SOURCE
#include <sys/socket.h>
int foo(struct cmsghdr *header, struct msghdr msg) {
header = CMSG_NXTHDR(&msg, header);
return 0;
}
=============================
error:
../../../../../../../workspace/sources/libkcapi/lib/kcapi-kernel-if.c:25:11:
error: comparison of integers of different signs: 'unsigned long' and 'long'
[-Werror,-Wsign-compare]
header = CMSG_NXTHDR(&msg, header);
^~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/a/oe/build/tmp/work/core2-64-bec-linux-musl/libkcapi/1.1.3+git999-r0/recipe-sysroot/usr/include/sys/socket.h:299:44:
note: expanded from macro 'CMSG_NXTHDR'
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) -
(unsigned char *)(cmsg) \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
=============================
cmdline:
x86_64-bec-linux-musl-clang
--sysroot=/mnt/a/oe/build/tmp/work/core2-64-bec-linux-musl/libkcapi/1.1.3+git999-r0/recipe-sysroot
-c lib/kcapi-kernel-if.c -O -Werror -Wextra</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>