<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: condition with const enum evaluates to true and then to false"
href="http://llvm.org/bugs/show_bug.cgi?id=19468">19468</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>False positive: condition with const enum evaluates to true and then to false
</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=12392" name="attach_12392" title="scan-build results">attachment 12392</a> <a href="attachment.cgi?id=12392&action=edit" title="scan-build results">[details]</a></span>
scan-build results
Version:
clang-analyzer-3.4-6.fc20.noarch
clang-3.4-6.fc20.x86_64
Problem:
Analyzer claims that the condition on the same variable evaluates to two
different results:
Please note that variable in question is "const isc_boolean_t new_zone".
1901 static isc_result_t ATTR_NONNULLS ATTR_CHECKRESULT
1902 zone_sync_apex(ldap_instance_t *inst, ldap_entry_t *entry, dns_name_t
name,
1903 sync_state_t sync_state, const isc_boolean_t new_zone,
1904 dns_db_t *ldapdb, dns_db_t *rbtdb, dns_dbversion_t *version,
1905 dns_diff_t *diff, isc_uint32_t *new_serial,
1906 isc_boolean_t *ldap_writeback) {
...
1935 if (new_zone == ISC_FALSE)
Assuming 'new_zone' is not equal to isc_boolean_false
Taking false branch
1936 CHECK(dns_db_getsoaserial(rbtdb, version, &curr_serial));
1937
1938 /* Detect if SOA serial is affected by the update or not.
1939 * Always bump serial in case of re-synchronization. */
1940 CHECK(diff_analyze_serial(diff, &soa_tuple, &data_changed));
1941 if (new_zone == ISC_TRUE || data_changed == ISC_TRUE ||
Assuming 'new_zone' is not equal to isc_boolean_true
It is interesting that the problem disappears if I change
1935 if (new_zone == ISC_FALSE)
to
1935 if (new_zone != ISC_TRUE)
Relevant definitions are:
typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t;
#define ISC_FALSE isc_boolean_false
#define ISC_TRUE isc_boolean_true
#define ISC_TF(x) ((x) ? ISC_TRUE : ISC_FALSE)
Maybe the analyzer assumes that the value can be something else than 0 or 1?</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>