TY - JOUR
T1 - A rewriting logic approach to static checking of units of measurement in C
AU - Hills, Mark
AU - Chen, Feng
AU - Roşu, Grigore
N1 - Funding Information:
1 Supported by NSF CCF-0448501 and NSF CNS-0509321. 2 Email: [email protected] 3 Email: [email protected] 4 Email: [email protected]
PY - 2012/12/20
Y1 - 2012/12/20
N2 - Many C programs assume the use of implicit domain-specific information. A common example is units of measurement, where values can have both a standard C type and an associated unit. However, since there is no way in the C language to represent this additional information, violations of domain-specific policies, such as unit safety violations, can be difficult to detect. In this paper we present a static analysis, based on the use of an abstract C semantics defined using rewriting logic, for the detection of unit violations in C programs. In contrast to typed approaches, the analysis makes use of annotations present in C comments on function headers and in function bodies, leaving the C language unchanged. Initial evaluation results show that performance scales well, and that errors can be detected without imposing a heavy annotation burden.
AB - Many C programs assume the use of implicit domain-specific information. A common example is units of measurement, where values can have both a standard C type and an associated unit. However, since there is no way in the C language to represent this additional information, violations of domain-specific policies, such as unit safety violations, can be difficult to detect. In this paper we present a static analysis, based on the use of an abstract C semantics defined using rewriting logic, for the detection of unit violations in C programs. In contrast to typed approaches, the analysis makes use of annotations present in C comments on function headers and in function bodies, leaving the C language unchanged. Initial evaluation results show that performance scales well, and that errors can be detected without imposing a heavy annotation burden.
KW - Unit safety
KW - abstract semantics
KW - rewriting logic
KW - static analysis
UR - http://www.scopus.com/inward/record.url?scp=84871181692&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84871181692&partnerID=8YFLogxK
U2 - 10.1016/j.entcs.2012.11.011
DO - 10.1016/j.entcs.2012.11.011
M3 - Article
AN - SCOPUS:84871181692
SN - 1571-0661
VL - 290
SP - 51
EP - 67
JO - Electronic Notes in Theoretical Computer Science
JF - Electronic Notes in Theoretical Computer Science
ER -