Hi Gabriel, Thanks for your feedback. I modified the code, however, it does not work.
let d_cfgedge (src) () (dest) =
match src.skind with
| If (_, tb, fb, _) ->
(if (List.memq dest tb.bstmts) then
dprintf "%a -> %a [label=\"true\"]"
d_cfgnodename src
d_cfgnodename dest
else if (List.memq dest fb.bstmts) then
dprintf "%a -> %a [label=\"false\"]"
d_cfgnodename src
d_cfgnodename dest
else
dprintf "%a -> %a"
d_cfgnodename src
d_cfgnodename dest);
| _ -> dprintf "%a -> %a"
d_cfgnodename src
d_cfgnodename dest
The attachment is my example (you may focus on function named "test"). It
still hits the highlighted case.
Thanks,
Haihao
On Wed, Jul 21, 2010 at 3:09 PM, Gabriel Kerneis <[email protected]>wrote:
> Hi ,
>
> On Wed, Jul 21, 2010 at 02:55:48PM +0800, haihao shen wrote:
> > let d_cfgedge (src) () (dest) =
> > match src.skind with
> > | If (_, tb, fb, _) ->
> > (if (List.mem dest tb.bstmts) then
> > dprintf "%a -> %a [label=\"true\"]"
> > d_cfgnodename src
> > d_cfgnodename dest
> > else if (List.mem dest fb.bstmts) then
> > dprintf "%a -> %a [label=\"false\"]"
> > d_cfgnodename src
> > d_cfgnodename dest
> > else
> > dprintf "%a -> %a [label=\"true$\"]"(*true likely, note that no
> false
> > likely!!!*)
> > d_cfgnodename src
> > d_cfgnodename dest);
> > | _ -> dprintf "%a -> %a"
> > d_cfgnodename src
> > d_cfgnodename dest
>
> You probably want to use List.memq (physical identity) rather than
> List.mem. Except if you copy some statements during your
> transformations, but this is bad practice in CIL and should be avoided
> as much as possible.
>
> If you still have problems, send a minimal exemple here (e.g. the code
> of the C function where the highlighted code is hit).
>
> Regards,
> --
> Gabriel Kerneis
>
example.c
Description: Binary data
------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________ CIL-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cil-users
