From mboxrd@z Thu Jan 1 00:00:00 1970 From: linjia@ruijie.com.cn (=?gb2312?B?wda8ziizzLb+ILij1t0p?=) Date: Tue, 21 Jan 2014 05:52:25 +0000 Subject: [Cocci] =?gb2312?b?tPC4tDogIGhvdyB0byBtYXRjaCB0aGlzIGNhc2U/?= In-Reply-To: References: <041CF35939B5534D851F16C30DD0B8CF727F4841@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F485B@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F488A@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F5C4F@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F5CA5@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F5D5A@fzex.ruijie.com.cn> <041CF35939B5534D851F16C30DD0B8CF727F89C4@fzex.ruijie.com.cn> Message-ID: <041CF35939B5534D851F16C30DD0B8CF727F8A3E@fzex.ruijie.com.cn> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr Sorry, I made a mistake , if the checkpoint is local variable, I should write as -int vp; -T I[C]; -<+... -if(vp > C || ...){ -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?21? 11:35 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] how to match this case? On Tue, 21 Jan 2014, ??(?? ??) wrote: > Following is a code with bug > > ----------------------------------- > void set_timeout_value(int iParam) > { > int i; > byte b[100]; > i = Geti(); > if (i > 100 || i < 0){ > return ; > } > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > } > ----------------------------------- > Now I write a patch to find it, like this > > @@ > identifier fn, vp; > identifier I; > type T; > expression C; > @@ > -fn(...,int vp,...) > -{ > -T I[C]; > -<+... > -if(vp > C || ...){ > -... > -} > -...+> > -} > > > But it doesn?t work, give me a log: > rule starting on line 1: position variables or mixed modifs interfere > with comm_assoc isobool (bool (int vp > int C) || ...) I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. julia > > can anyone tell why, thanks > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >