[PATCH] D12906: [RFC] Bug identification("issue_hash") change for CmpRuns.py

Honggyu Kim via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 07:56:00 PDT 2015


honggyu.kim created this revision.
honggyu.kim added reviewers: jordan_rose, krememek, zaks.anna, danielmarjamaki, babati, dcoughlin.
honggyu.kim added subscribers: cfe-commits, phillip.power, seaneveson, j.trofimovich, hk.kang, eszasip, dkrupp, o.gyorgy, xazax.hun, premalatha_mvs.

This patch brings bug identification method from D10305 to the existing infrastructure.
By applying this patch, two different bug reports can be compared with existing CmpRuns.py.

Currently, "issue_hash" in plist file is just line offset from the beginning of function.
But it even cannot distinguish those kind of simple cases that are completely different bugs.

BUG 1. garbage return value
```
1 int main()
2 {
3   int a;
4   return a;
5 }

test.c:4:3: warning: Undefined or garbage value returned to caller
  return a;
  ^~~~~~~~
```
BUG 2. garbage assignment
```
1 int main()
2 {
3   int a;
4   int b = a;
5   return b;
6 }

test.c:4:3: warning: Assigned value is garbage or undefined
  int b = a;
  ^~~~~   ~
```

Moreover, The following case are regarded as different bugs when it is compared with BUG 1.

BUG 3. a single line of comment is added based on BUG 1 code.
```
1 int main()
2 {
3   // main function
4   int a;
5   return a;
6 }

test.c:5:3: warning: Undefined or garbage value returned to caller
  return a;
  ^~~~~~~~
```
The comparison result is as follows:
```
REMOVED: 'test.c:4:3, Logic error: Undefined or garbage value returned to caller'
ADDED: 'test.c:5:3, Logic error: Undefined or garbage value returned to caller'
TOTAL REPORTS: 1
TOTAL DIFFERENCES: 2
```

This patch brought the bug identification method and code from D10305, and it generates the "issue_hash" with the following information:
1. column number
2. source line string after removing whitespace
3. bug type (bug message)

This patch is not the final solution, but it enhances "issue_hash" to distinguish such kind of cases by generating stronger hash value.

http://reviews.llvm.org/D12906

Files:
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12906.34891.patch
Type: text/x-patch
Size: 4489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150916/1c470180/attachment-0001.bin>


More information about the cfe-commits mailing list