Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: riccardo.lucchese@gmail.com (Riccardo Lucchese)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [bug-cocci] "badly compiled mcode" error
Date: Tue, 22 Jul 2014 15:43:09 +0200	[thread overview]
Message-ID: <20140722134309.GA30105@rlp> (raw)
In-Reply-To: <alpine.DEB.2.10.1407221455390.2366@hadrien>

On Tue, Jul 22, 2014 at 02:55:57PM +0200, Julia Lawall wrote:
> A patch is below.
> 
> julia

Thank you, I cannot reproduce the error with this applied.

riccardo


> diff --git a/parsing_cocci/iso_compile.ml b/parsing_cocci/iso_compile.ml
> index 5e39b9c..7921f44 100644
> --- a/parsing_cocci/iso_compile.ml
> +++ b/parsing_cocci/iso_compile.ml
> @@ -52,7 +52,7 @@ let process_info l =
>  	 let safe_add p pos =
>  	   (* don't add pos var where a pos var is already present *)
>  	   if Common.inter_set previously_used pos = [] then p::pos else pos in
> -	 let p =
> +	 let new_previously_used =
>  	   if List.for_all (List.for_all (function e -> List.length e = 1)) a
>  	   then
>  	     let p = get_p() in
> @@ -60,22 +60,23 @@ let process_info l =
>  	       (List.iter
>  		  (List.iter (function (_,pos) -> pos := safe_add p !pos)))
>  	       a;
> -	     [p]
> +	     p::previously_used
>  	   else
>  	     let all = r @ List.concat xs in
> -	     let rec find_first_available a = function
> +	     let rec find_first_available a previously_used = function
>  		 [] -> raise Not_found
>  	       | (str,pos)::xs ->
>  		   if str = a && Common.inter_set previously_used !pos = []
>  		   then pos
> -		   else find_first_available a xs in
> +		   else find_first_available a previously_used xs in
>  	     List.fold_left
>  	       (function prev ->
>  		 function (str,pos) ->
>  		   if Common.inter_set previously_used !pos = []
>  		   then
>  		     try
> -		       let entries = List.map (find_first_available str) all in
> +		       let entries =
> +			 List.map (find_first_available str prev) all in
>  		       let p = get_p() in
>  		       pos := p::!pos;
>  		       List.iter (function pos -> pos := p :: !pos) entries;
> @@ -83,8 +84,8 @@ let process_info l =
>  		     with Not_found -> prev
>  		   (* otherwise already annotated *)
>  		   else prev)
> -	       [] f in
> -	 loop (p at previously_used) xs
> +	       previously_used f in
> +	 loop new_previously_used xs
>       | _ -> failwith "bad iso" in
>     loop l
> 

      reply	other threads:[~2014-07-22 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 18:42 [Cocci] [bug-cocci] "badly compiled mcode" error Riccardo Lucchese
2014-07-21 19:47 ` Julia Lawall
2014-07-22 12:55 ` Julia Lawall
2014-07-22 13:43   ` Riccardo Lucchese [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140722134309.GA30105@rlp \
    --to=riccardo.lucchese@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox