[cfe-dev] Possible clang bug with -O2, wrong if branch entered, in clang version 2.1 (tags/Apple/clang-163.7.1)

Salvatore Sanfilippo antirez at gmail.com
Tue Feb 21 10:46:06 PST 2012

On Tue, Feb 21, 2012 at 7:34 PM, Matthieu Monrocq
<matthieu.monrocq at gmail.com> wrote:
> Hello Salvatore,
> would you mind showing on this list the bugs that the static analyzer found
> in Redis ?
> A few pointers to the patches where those bugs were fixed would be amply
> sufficient.

Sure, including today's undefined behavior (not found by the static
analyzer) I fixed three bugs thanks to clang so far:

$ git log --oneline | grep clang
7c96b46 Fixed undefined behavior in *INCR style functions overflow
detection. Sorry clang!
4e97c2c Fixed another possible bug in cluster.c found by clang --analyze.
6710ff2 Fixed a non critical bug signaled by clang static analyzer
thanks to Mukund Sivaraman for reporting it: there was a not
initialized field populating the cluster message header, but it is
always fixed at later time before sending the packet.

You can see patches you can simply go here:


For instance: https://github.com/antirez/redis/commit/4e97c2c


Salvatore 'antirez' Sanfilippo
open source developer - VMware

"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele

More information about the cfe-dev mailing list