CCured
In this paper we propose a scheme that combines type inference and run-time checking to make existing C programs type safe. We describe the CCured type system, which extends that of C by separating pointer types according to their usage. This type sysiem allows both pointers whose usage can be verif...
Published in: | ACM SIGPLAN Notices |
---|---|
Main Authors: | , , |
Format: | Article in Journal/Newspaper |
Language: | English |
Published: |
Association for Computing Machinery (ACM)
2012
|
Subjects: | |
Online Access: | http://dx.doi.org/10.1145/2442776.2442786 https://dl.acm.org/doi/pdf/10.1145/2442776.2442786 |
id |
cracm:10.1145/2442776.2442786 |
---|---|
record_format |
openpolar |
spelling |
cracm:10.1145/2442776.2442786 2024-09-09T20:11:42+00:00 CCured type-safe retrofitting of legacy code Necula, George C. McPeak, Scott Weimer, Westley 2012 http://dx.doi.org/10.1145/2442776.2442786 https://dl.acm.org/doi/pdf/10.1145/2442776.2442786 en eng Association for Computing Machinery (ACM) ACM SIGPLAN Notices volume 47, issue 4a, page 74-85 ISSN 0362-1340 1558-1160 journal-article 2012 cracm https://doi.org/10.1145/2442776.2442786 2024-06-17T04:03:11Z In this paper we propose a scheme that combines type inference and run-time checking to make existing C programs type safe. We describe the CCured type system, which extends that of C by separating pointer types according to their usage. This type sysiem allows both pointers whose usage can be verified statically to be type safe, and pointers whose safety must be checked at run time. We prove a type soundness result and then we present a surprisingly simple type inference algoriihm that is able lo infer the appropriate pointer kinds for existing C programs. Our experience wiih the CCured sysiem shows that the inference is very effective for many C programs, as it is able to infer that most or all of the pointers are statically verifiable to be type safe. The remaining pointers are instrumented wiih efficient run-time checks to ensure that they are used safely. The resulting performance loss due to run-time checks is 0-150%, which is several times better than comparable approaches thai use only dynamic checking. Using CCured we have discovered programming bugs in established C programs such as several SPECINT95 benchmarks. Article in Journal/Newspaper The Pointers ACM Publications (Association for Computing Machinery) ACM SIGPLAN Notices 47 4a 74 85 |
institution |
Open Polar |
collection |
ACM Publications (Association for Computing Machinery) |
op_collection_id |
cracm |
language |
English |
description |
In this paper we propose a scheme that combines type inference and run-time checking to make existing C programs type safe. We describe the CCured type system, which extends that of C by separating pointer types according to their usage. This type sysiem allows both pointers whose usage can be verified statically to be type safe, and pointers whose safety must be checked at run time. We prove a type soundness result and then we present a surprisingly simple type inference algoriihm that is able lo infer the appropriate pointer kinds for existing C programs. Our experience wiih the CCured sysiem shows that the inference is very effective for many C programs, as it is able to infer that most or all of the pointers are statically verifiable to be type safe. The remaining pointers are instrumented wiih efficient run-time checks to ensure that they are used safely. The resulting performance loss due to run-time checks is 0-150%, which is several times better than comparable approaches thai use only dynamic checking. Using CCured we have discovered programming bugs in established C programs such as several SPECINT95 benchmarks. |
format |
Article in Journal/Newspaper |
author |
Necula, George C. McPeak, Scott Weimer, Westley |
spellingShingle |
Necula, George C. McPeak, Scott Weimer, Westley CCured |
author_facet |
Necula, George C. McPeak, Scott Weimer, Westley |
author_sort |
Necula, George C. |
title |
CCured |
title_short |
CCured |
title_full |
CCured |
title_fullStr |
CCured |
title_full_unstemmed |
CCured |
title_sort |
ccured |
publisher |
Association for Computing Machinery (ACM) |
publishDate |
2012 |
url |
http://dx.doi.org/10.1145/2442776.2442786 https://dl.acm.org/doi/pdf/10.1145/2442776.2442786 |
genre |
The Pointers |
genre_facet |
The Pointers |
op_source |
ACM SIGPLAN Notices volume 47, issue 4a, page 74-85 ISSN 0362-1340 1558-1160 |
op_doi |
https://doi.org/10.1145/2442776.2442786 |
container_title |
ACM SIGPLAN Notices |
container_volume |
47 |
container_issue |
4a |
container_start_page |
74 |
op_container_end_page |
85 |
_version_ |
1809946272608550912 |