User loginNavigation |
archivesState of the Union: Type Inference via Craig InterpolationState of the Union: Type Inference via Craig Interpolation, by Ranjit Jhala, Rupak Majumdar, and Ru-Gang Xu The ad-hoc use of unions to encode disjoint sum types in C programs and the inability of C's type system to check the safe use of these unions is a long standing source of subtle bugs. We present a dependent type system that rigorously captures the ad-hoc protocols that programmers use to encode disjoint sums, and introduce a novel technique for automatically inferring, via Craig Interpolation, those dependent types and thus those protocols. In addition to checking the safe use of unions, the dependent type information inferred by interpolation gives programmers looking to modify or extend legacy code a precise understanding of the conditions under which some fields may be safely accessed. We present an empirical evaluation of our technique on 350KLOC of open source C code. In 80 out of 90 predicated edges (corresponding to 1472 out of 1684 union accesses), our type system is able to infer the correct dependent types. This demonstrates that our type system captures and explicates programmers' informal reasoning about unions, without requiring manual annotation or rewriting. By Jim Apple at 2007-02-04 05:05 | Implementation | Type Theory | 4 comments | other blogs | 6110 reads
|
Browse archivesActive forum topics |
Recent comments
22 weeks 14 hours ago
22 weeks 18 hours ago
22 weeks 18 hours ago
44 weeks 1 day ago
48 weeks 3 days ago
50 weeks 1 day ago
50 weeks 1 day ago
1 year 4 days ago
1 year 5 weeks ago
1 year 5 weeks ago