On Mon, 8 Aug 2011, Lucas De Marchi wrote: > Hi Julia > > On Mon, Aug 8, 2011 at 11:55 AM, Julia Lawall <[email protected]> wrote: > > On Mon, 8 Aug 2011, Lucas De Marchi wrote: > > > >> Is there a cocci script to find the use of VLAs? > > > > What is a VLA? > > Variable length array. I used the following script, but it doesn't > detect all the cases. What I need is to detect whether the size of the > array is discovered by the compiler at compile time or at run time. > > > @r1@ > constant c1, c2, c3, c4; > expression e; > type x; > identifier x1; > @@ > ( > x x1[c1]; > | > x x1[c1 + c2]; > | > x x1[c1 + c2 + c3]; > | > x x1[c1 + c2 + c3 + c4]; > | > * x x1[e]; > )
Maybe the following: @r@ type t; identifier x,i; position p; @@ t x[<+...i@p...+>] @s@ position r.p; constant c; type t; identifier x; @@ t x[<+...c@p...+>] @depends on !s@ position r.p; type t; identifier x,i; @@ *t x[<+...i@p...+>] julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
