Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

False positive for potentially memory leak after transferring ownership to C array storage of > 1 dimension #18965

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18966
Status NEW
Importance P normal
Reported by Tom Bunch (tom+bugzilla@omnigroup.com)
Reported on 2014-02-25 13:06:19 -0800
Last modified on 2014-02-26 11:49:08 -0800
Version 3.3
Hardware Macintosh MacOS X
CC jrose@belkadan.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments ReallyBadStringCache.m (1447 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 12143
Self contained .m file

When retained objects are assigned into a C array of greater than 1 dimension
in a longer lived scope, the objects a potential leak is reported. I have tried
this with a static global 2d array and an instance ivar. Attached test case
contains both flavors.

Note that the same error does not occur with a 1d array.
Quuxplusone commented 10 years ago

Attached ReallyBadStringCache.m (1447 bytes, application/octet-stream): Self contained .m file

Quuxplusone commented 10 years ago
More data: if the second index is replaced by a constant, or the first index is
replaced by 0, the warning goes away.

My guess is that the analyzer is just unable to represent the location
"foo[x][y]", because it's "&foo + x * sizeof(foo[0]) + y".
Quuxplusone commented 10 years ago

Cloned to rdar://problem/16173744