<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 --- - strcmp call modifies constant value in adjacent struct"
href="http://llvm.org/bugs/show_bug.cgi?id=19661">19661</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>strcmp call modifies constant value in adjacent struct
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>pspacek@redhat.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>Created <span class=""><a href="attachment.cgi?id=12482" name="attach_12482" title="minimal test case">attachment 12482</a> <a href="attachment.cgi?id=12482&action=edit" title="minimal test case">[details]</a></span>
minimal test case
Static analyzer thinks that strcmp() modifies memory adjacent to strcmp()
parameters. The problem doesn't happen if I use strcasecmp() instead of
strcmp(). Please see attached minimal example and report file.
Excerpt:
18 switch (setting->type) {
Control jumps to 'case ST_STRING:' at line 19
19 case ST_STRING:
20 /* strcmp triggers the error */
21 if (strcmp(setting->value_char, value) == 0)
Taking false branch
22 /* but strcasecmp doesn't trigger the error! */
23 //if (strcasecmp(setting->value_char, value) == 0)
24 return 1;
25 break;
...
33 switch (setting->type) {
Control jumps to 'case ST_UNSIGNED_INTEGER:' at line 37
Apparently, analyzer thinks that setting->type was changed in strcmp() call.
Please see attached files for structure definitions etc.
Have a nice day!</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>