Ocaml's compare function should work for CIL statements and expressions,
because it checks for physical equality before recursing. You can also use
Util.equals. Putting "let (=?) = Util.equals" at the top of your CIL file
will remap = to something that will work for CIL's cyclic values.
Cheers,
Matt
On Sun, Feb 22, 2009 at 4:15 PM, Matthieu Wipliez <mwipl...@yahoo.fr> wrote:
> Hi,
>
> a Cil.stmt contains references to its predecessors and successors, so
> indeed it is kind of cyclic. If you have two following statements s1 and s2
> they will reference each other, and I guess OCaml just goes out of memory by
> recursing between them.
>
> The documentation states that sid is only valid after CFG has been
> computed, so this is a good choice if you need to compute the CFG before you
> need to compare statements.
>
> Otherwise I would just go with physical equality using "==", but this might
> not suit your needs depending on your comparison criterion (in which case
> you will probably need to write your own "compare" function).
>
> Cheers,
> Matthieu
>
> ------------------------------
> *De :* John Smith <legit.a...@gmail.com>
> *À :* CIL-users Mailing List <CIL-users@lists.sourceforge.net>
> *Envoyé le :* Dimanche, 22 Février 2009, 22h32mn 48s
> *Objet :* [CIL users] Proper way to compare two Cil.stmt's?
>
> Hi:
>
> I need to compare 2 Cil.stmt's, and I was using "stm1 = stm2", but this
> caused an Out-of-memory fatal exception. It worked when I changed it to
> "stm1.sid = stm2.sid". Why did the first method fail? Is Cil.stmt a cyclic
> structure or something?
> Is there a better way to compare two Cil.stmt's?
>
> Cheers,
> legit
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> CIL-users mailing list
> CIL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cil-users
>
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users