On Tue, 21 Jan 2014, 林嘉(程二 福州) wrote:

> I see, I should add '()' if I use '|'

Yes :)

julia

> 
> 
> -----邮件原件-----
> 发件人: [email protected] [mailto:[email protected]] 代表 
> 林嘉(程二 福州)
> 发送时间: 2014年1月21日 14:44
> 收件人: Julia Lawall
> 抄送: [email protected]
> 主题: [Cocci] 答复: 答复: how to match this case?
> 
> Thanks for remind.
> But to the "|" operator , I still don’t know how to use, for example, I wrote
> 
> 
> @disable comm_assoc@
> identifier fn, p;
> identifier I;
> type T,T1;
> expression C;
> @@
> -fn(...)
> -{
> -int p;
> -...
> -T I[C];
> | 
> -T I[C];
> -...
> -int p;
> -<+...
> -if(p > C){
> -...
> -}
> -...+>
> -}
> 
> 
> 
> It reports: init_defs_builtins: /usr/share/coccinelle/standard.h
> 126 127
> Fatal error: exception Failure("minus: parse error: 
>  = File "os.cocci", line 12, column 0,  charpos = 126
>     around = '|', whole content = |
> ")
> 
> -----邮件原件-----
> 发件人: Julia Lawall [mailto:[email protected]]
> 发送时间: 2014年1月21日 14:32
> 收件人: 林嘉(程二 福州)
> 抄送: [email protected]
> 主题: Re: 答复: [Cocci] how to match this case?
> 
> On Tue, 21 Jan 2014, 林嘉(程二 福州) wrote:
> 
> > Sorry, I made a mistake , if the checkpoint is local variable, I 
> > should write as
> > 
> > -int vp;
>   ...
> > -T I[C];
> 
> Also, you don't know if the array is declared before or after vp.  So you 
> would need 
> 
> (
> - int vp;
>   ...
> - T I[C];
> |
> - T I[C];
>   ...
> - int vp;
> )
> 
> julia
> 
> > -<+...
> > -if(vp > C || ...){
> > 
> > -----邮件原件-----
> > 发件人: Julia Lawall [mailto:[email protected]]
> > 发送时间: 2014年1月21日 11:35
> > 收件人: 林嘉(程二 福州)
> > 抄送: [email protected]
> > 主题: 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
> > > [email protected]
> > > https://systeme.lip6.fr/mailman/listinfo/cocci
> > > 
> > 
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
> 
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to