[PATCH 0/7] delete double assignment

From: Julia Lawall
Date: Sat Aug 23 2014 - 14:37:18 EST


These patches fix cases where there are two adjacent assignments to the
same location. In practice, many such occurrences appear to be
intentional, eg to initialize volatile memory, but these cases do not seem
to fall into that category.

The complete semantic match that finds these problems is as follows:

// <smpl>
@r@
expression i,f;
position p1,p2;
@@

(
i = <+...f(...)...+>;
|
i |= <+...f(...)...+>;
|
i &= <+...f(...)...+>;
|
i += <+...f(...)...+>;
|
i -= <+...f(...)...+>;
|
i *= <+...f(...)...+>;
|
i /= <+...f(...)...+>;
|
i %= <+...f(...)...+>;
|
i ^= <+...f(...)...+>;
|
i <<= <+...f(...)...+>;
|
i >>= <+...f(...)...+>;
|
i@p1 = ...;
|
i@p1 |= ...;
|
i@p1 &= ...;
|
i@p1 += ...;
|
i@p1 -= ...;
|
i@p1 *= ...;
|
i@p1 /= ...;
|
i@p1 %= ...;
|
i@p1 ^= ...;
|
i@p1 <<= ...;
|
i@p1 >>= ...;
|
i@p1 ++;
|
++i@p1;
|
i@p1 --;
|
--i@p1;
)
(
i = <+...i...+>;
|
i = <+...f(...)...+>;
|
i@p2 = ...;
)

@@
expression i,j,f;
position r.p1,r.p2;
@@

(
(<+...i@xxxxx+>);
)
(
(<+...\(j++\|++j\|j--\|--j\|f(...)\)...+>) = ...;
|
*i@p2 = ...;
)
// </smpl>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/