lkml.org 
[lkml]   [2014]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/7] delete double assignment
Date
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@p1...+>);
)
(
(<+...\(j++\|++j\|j--\|--j\|f(...)\)...+>) = ...;
|
*i@p2 = ...;
)
// </smpl>



\
 
 \ /
  Last update: 2014-08-23 21:01    [W:0.084 / U:2.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site