Physical type checking for C
Satish Chandra, Thomas Reps · ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering (PASTE) · 1999
The effectiveness of traditional type checking in C is limited by the presence of type conversions using type casts. Because the C standard allows arbitrary type conversions between pointer types, neither C compilers, nor tools such as lint, can guarantee type safety in the presence of such type conversions. In particular, by using casts involving pointers to structures (C structs), a programmer can interpret any memory region to be of any desired type, further compromising C's weak type system. Not only do type casts make program vulnerable to type errors, they hinder program comprehension and maintenance by creating latent dependencies between seemingly independent pieces of code. To address these problems, we have developed a stronger form of type checking for C programs, called physical type checking. Physical type checking takes into account the layout of C struct fields in memory. This paper describes an inference-based physical type checking algorithm and its implementation. Ou...
Cited by 61 works. doi:10.1145/316158.316183
Authors
References
- Lint, a C Program Checker
- A semantics of multiple inheritance
- Efficient context-sensitive pointer analysis for C programs
- Static detection of dynamic memory errors
- Efficient context-sensitive pointer analysis for C programs
- Fast and accurate flow-insensitive points-to analysis
- Aggregate structure identification and its application to program analysis
- Projections for strictness analysis
- Points-to analysis by type inference of programs with structures and unions
- Pointer analysis for programs with structures and casting