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

            Bug ID: 15307
           Summary: Incorrect "Assigned value is always the same as the
                    existing value"
           Product: clang
           Version: 3.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

It appears that the static analyzer doesn't understand C structure
copies.  The warning below would be correct without the "*a = *b;"
statement.

typedef struct {
  int x;
  int y;
} bar;

void
foo (bar *a, bar *b)
{
  int x;

  x = a->x;
  *a = *b;
  a->x = x;
}


welinder@anemone ~ $ scan-build -v make aaa.o
scan-build: 'clang' executable not found in '/usr/share/clang/scan-build/bin'.
scan-build: Using 'clang' from path: /usr/bin/clang
scan-build: Emitting reports for this run to '/tmp/scan-build-2013-02-19-5'.
/usr/share/clang/scan-build/ccc-analyzer    -c -o aaa.o aaa.c
aaa.c:13:8: warning: Assigned value is always the same as the existing value
  a->x = x;
  ~~~~ ^ ~
1 warning generated.
scan-build: 1 bugs found.

welinder@anemone ~ $ clang --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

-- 
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