http://llvm.org/bugs/show_bug.cgi?id=19661

            Bug ID: 19661
           Summary: strcmp call modifies constant value in adjacent struct
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 12482
  --> http://llvm.org/bugs/attachment.cgi?id=12482&action=edit
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!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to