Re: I found a Clang analyzer bug!
Re: I found a Clang analyzer bug!
- Subject: Re: I found a Clang analyzer bug!
- From: Chris Lattner <email@hidden>
- Date: Thu, 20 Mar 2014 10:22:02 -0700
On Mar 19, 2014, at 11:05 AM, Matt Neuburg <email@hidden> wrote:
> There is a leak in this (meaningless, artificially pared-down) code (self is a CALayer subclass):
>
> - (void) setup {
> CAShapeLayer* circle = [CAShapeLayer new];
> CGMutablePathRef p = CGPathCreateMutable();
> CGPathAddEllipseInRect(p, nil, CGRectInset(self.bounds, 3, 3));
> circle.path = p;
> // CGPathRelease(p);
>
> // return // uncomment this line
>
> // the four cardinal points
> NSArray* pts = @[@"N", @"E", @"S", @"W"];
> for (int i = 0; i < 4; i++) {
> CATextLayer* t = [CATextLayer new];
> t.string = pts[i];
> }
> }
>
> We are not calling CGPathRelease, but the analyzer is silent. Here's the Really Interesting Part: if you uncomment the "return" line, the analyzer correctly complains! Thus I infer that there is something about the lines after "the four cardinal points" that causes the analyzer to lose track of this leak.
>
> What's the appropriate way to report this? Should I just use the bugreporter, or does this need to go to the clang folks? Thx - m.
Hi Matt,
The preferred way is to file a bug with apple’s bugreporter, but if you’re interested in using open source builds from clang.llvm.org, you can also file it at http://llvm.org/bugs/ as Sean says.
In this case, the bug is already reported as http://llvm.org/bugs/show_bug.cgi?id=7638.
The issue is that the analyzer has a fixed number of loop iterations that it is willing to evaluate before it decides that going farther would be good expensive.
-Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden