Clang static analysis results for dmd

Robert Clipsham robert at octarineparrot.com
Tue Jul 26 12:36:16 PDT 2011


On 26/07/2011 19:08, Walter Bright wrote:
> It's not a bug in dmc. The code is quite deliberate and necessary. The
> bug is in clang.

$ cat test.c
#include <stdint.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
     uint64_t value = atoi(argv[0]);
     if ((unsigned short)value != value)
     {
         return 0;
     }
     return 1;
}
$ scan-build clang -g test.c

Note that this leads to no errors from the analyzer - it will only flag 
it if it knows statically whether value fits within an unsigned short or 
not. We'll see if it's still flagged when I re-run it.

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list