<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:jordan_rose@apple.com" title="Jordan Rose <jordan_rose@apple.com>"> <span class="fn">Jordan Rose</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - 3.4: memchr(NULL, '=', 0) is defined as NULL"
href="http://llvm.org/bugs/show_bug.cgi?id=18247">bug 18247</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>jordan_rose@apple.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - 3.4: memchr(NULL, '=', 0) is defined as NULL"
href="http://llvm.org/bugs/show_bug.cgi?id=18247#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - 3.4: memchr(NULL, '=', 0) is defined as NULL"
href="http://llvm.org/bugs/show_bug.cgi?id=18247">bug 18247</a>
from <span class="vcard"><a class="email" href="mailto:jordan_rose@apple.com" title="Jordan Rose <jordan_rose@apple.com>"> <span class="fn">Jordan Rose</span></a>
</span></b>
<pre>This is actually invalid according to the C standard:
C11 7.24.1p2: Where an argument declared as "size_t n" specifies the length of
the array for a function, n can have the value zero on a call to that function.
Unless explicitly stated otherwise in the description of a particular function
in this subclause, pointer arguments on such a call shall still have valid
values, as described in 7.1.4. On such a call, a function that locates a
character finds no occurrence, a function that compares two character sequences
returns zero, and a function that copies characters copies zero characters.
C11 7.1.4p1: [...] If an argument to a function has an invalid value (such as
[...] a null pointer [...]) [...], the behavior is undefined.
The description of memchr (C11 7.24.5.1) doesn't mention that null pointers are
valid, so it's not safe to assume that they are on all platforms.</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>