[cfe-dev] fix for Clang PR 8419

Zhanyong Wan (λx.x x) wan at google.com
Fri Nov 19 10:38:12 PST 2010


Hi, Ted,

I made a new patch based on our discussion last night.  I've uploaded
it to http://codereview.appspot.com/2920041/ (the raw patch can be
found at http://codereview.appspot.com/download/issue2920041_2001.diff).

Things to note:

1. In addition to trying to fix PR8419, I also added comments that
helped me understand how the code I'm touching works.

2. The meat of the fix is in CFG.cpp.  I'm still not sure if this is a
principled fix, but all tests pass, so I hope it's at least an
improvement.

Would you please take a look?  Thanks!

On Thu, Nov 4, 2010 at 5:28 PM, Zhanyong Wan (λx.x x) <wan at google.com> wrote:
> Hi Ted,
>
> I'm working on fixing PR8419, and would like to check with you if I'm
> on the right track.
>
> As I found out, the analyzer crashes on
>
>  ++s[0];
>
> as it expects s[0] to be a Loc (which it should be), but instead sees a NonLoc.
>
> Upon reading the analyzer code, I see two things that don't seem right:
>
> 1. EnvironmentManager::bindExprAndLocation() throws away the
> 'location' argument.
>
> 2. GRExprEngine.cpp calls state->getSVal(Ex) to get the location of
> Ex, but the implementation of getSVal(Ex) doesn't use the right key
> (should be something like MakeLocation(Ex) to look up the expression.
>
> Please see http://codereview.appspot.com/2920041/ for a very early
> draft.  It's not yet cleaned up and some changes aren't strictly
> necessary -- I'll clean up after the discussion.
>
> I'm sure it's not quite right, as I'm still figuring out how the
> analyzer works.  (I wish there are more comments in the code. ;)
>
> Could you let me know if the direction of the patch is correct?  What
> problems do you see in it?
>
> Also, what do you think is the best way to ramp up on the analyzer code base?
>
> Thanks,
> --
> Zhanyong
>



-- 
Zhanyong




More information about the cfe-dev mailing list