Method and apparatus for detecting violations of type rules in a computer program
Abstract
One embodiment of the present invention provides a system that detects violations of type rules in a computer program. The system operates by locating a type casting operation within the computer program, wherein the type casting operation involves a first pointer and a second pointer. The system then checks the type casting operation for a violation of a type rule. If a violation is detected, the system indicates the violation. In one embodiment of the present invention, if the first pointer is defined to be a structure pointer and the second pointer is not defined to be a structure pointer, the system indicates a violation of a type rule. In one embodiment of the present invention, if the first pointer is defined to point to a first structure type and the second pointer is defined to point to a second structure type, the system determines whether the first structure type and the second structure type belong to the same alias group. If not, the system generates an error to indicate a type violation.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 17 · Forward citations: 9.
Claims (3 — 1 Independent, 2 Dependent)
- Claim 1Independent Claim
A method for detecting violations of type casting rules in a computer program, comprising: receiving the computer program prior to compilation and execution, wherein the computer program is received in source code form; locating an explicit-type casting operation within the computer program, wherein the explicit type casting operation involves a first pointer and a second pointer; checking the explicit type casting operation for a violation of a type casting rule; and if a violation is detected, indicating the type-casting violation.
- Claim 2Depends on #1
The method of claim 1 , wherein checking the explicit type casting operation involves determining if the first pointer is defined to be a structure pointer and the second pointer is not defined to be a structure pointer, and if so, indicating a violation if no char exception applies.
- Claim 3Depends on #2
The method of claim 2 , whe
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗
Cited By — Indexed Forward Citations (9 of 9 total)
References Cited — Backward Prior Art (17)
Non-Patent Literature (5)
- "C User's Guide Supplement for the Forte Developer 6 update 1 (Sun WorkShop 6 update 1)", Sun Microsystems, Inc., Part No. 806-6145-10, Oct. 2000, Revision A, XP-002242198.
- Altucher et al., "An extended form of must alias analysis for dynamic allocation", Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, Jan. 1995.
- Austin et al., "Efficient detection of all pointer and array access errors", ACM SIGPLAN, pp 290-301, Jun. 1994.
- Bacon et al., "Fast static analysis of C++ virtual function calls", ACM SIGPLAN Notices, Proceedings of the 11th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, vol. 31 Issue 10, Oct. 1996.
- Diwan et al., "Type-based alias analysis", ACM SIGPLAN Notices , Proceedings of the ACM SIGPLAN 1998 conference on Programming language design and implementation, vol. 33 Issue 5, May 1998.