skip to main content
article
Free Access

Pointer analysis for programs with structures and casting

Authors Info & Claims
Published:01 May 1999Publication History
Skip Abstract Section

Abstract

Type casting allows a program to access an object as if it had a type different from its declared type. This complicates the design of a pointer-analysis algorithm that treats structure fields as separate objects; therefore, some previous pointer-analysis algorithms "collapse" a structure into a single variable. The disadvantage of this approach is that it can lead to very imprecise points-to information. Other algorithms treat each field as a separate object based on its offset and size. While this approach leads to more precise results, the results are not portable because the memory layout of structures is implementation dependent.This paper first describes the complications introduced by type casting, then presents a tunable pointer-analysis framework for handling structures in the presence of casting. Different instances of this framework produce algorithms with different levels of precision, portability, and efficiency. Experimental results from running our implementations of four instances of this framework show that (i) it is important to distinguish fields of structures in pointer analysis, but (ii) making conservative approximations when casting is involved usually does not cost much in terms of time, space, or the precision of the results.

References

  1. ABS94 T. Austin, S. Breach, and G. Sohi. Efficient detection of all pointer and array access errors. In A CM SIGPLAN '9~ Conference on Programming Language Design and Implementation, pages 290-301, June 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. And94 L.O. Andersen. Program Analysis and Specialization for the C Programming Language. P hD thesis, DiKU, University of Copenhagen, May 1994. (DIKU report 94/19).Google ScholarGoogle Scholar
  3. BCCH94 M. Burke, P. Carini, J.-D. Choi, and M. Hind. Flow-insensitive interprocedural alias analysis in the presence of pointers. In K. Pingali, U. Banerjee, D. Gelernter, A. Nicolau, and D. Padua, editors, Language and Compilers for Parallel Computing, 7th International Workshop, LNCS 892, pages 234-250. Springer- Verlag, August 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. CBC93 J. Choi, M. Burke, and P. Carini. Efficient flow-sensitive interporcedural computation of pointer-induced aliases and side effects. In A CM Symposium on Principles of Programming Languages, pages 232-245, January 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. EGH94 M. Emami, R. Ghiya, and L. Hendren. Contextsensitive interprocedural points-to analysis in the presence of function pointers. In A CM SIG- PLAN '9~ Conference on Programming Language Design and Implementation, pages 242- 256, June 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. ISO90 ISO/IEC. International Standard ISO/IEC 9899, Programming Languages- C. 1st Ed. 1990.Google ScholarGoogle Scholar
  7. LRZ93 W. Landi, B. Ryder, and S. Zhang. Interprocedural modification side effect analysis with pointer aliasing. In A CM SIGPLAN '93 Conference on Programming Language Design and Implementation, pages 56-67, June 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ruf95 E. Ruf. Context-insensitive alias analysis reconsidered. In A CM SIGPLAN '95 Conference on Programming Language Design and implementation, pages 13-22, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ryd98 B. Ryder. personal communication, September 1998.Google ScholarGoogle Scholar
  10. SH97a M. Shapiro and S. Horwitz. The effects of the precision of pointer analysis. In ~th International Symposium on Static Analysis, LNCS 1302. Springer-Verlag, September 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. SH97b M. Shapiro and S. Horwitz. Fast and accurate flow-insensitive points-to analysis. In A CM Symposium on Principles of Programming Languages, January 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. SRLZ98 P. Stocks, B. Ryder, W. Landi, and S. Zhang. Comparing flow and context sensitivity on the modification-side-effects problem. In International Symposium on Software Testing and Analysis, pages 21-31, March 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ste96a B. Steensgaard. Points-to analysis by type inference of programs with structures and unions. In International Conference on Compiler Construction, April 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ste96b B. Steensgaard. Points-to analysis in almost linear time. In A CM Symposium on Principles o/ Programming Languages, pages 32-41, January 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ton97 P. Tonella. Points-to analysis for program understanding. In Proceedings of the International Workshop on Program Comprehension, May 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. WFW+94 R. Wilson, R. French, C. Wilson, S. Amarasinghe, J. Anderson, S. Tjiang, S. Liao, C. Tseng, M. Hall, M. Lain, and J. Hennessy. SUIF: An infrastructure for research on parallelizing and optimizing compilers. In A CM SIGPLAN Notices, volume 29(12), pages 31- 37, December 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. WL95 R. Wilson and M. Lain. Efficient contextsensitive pointer analysis for C programs. In A CM SIGPLAN '95 Conference on Programming Language Design and Implementation, pages 1-12, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Pointer analysis for programs with structures and casting

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 34, Issue 5
      May 1999
      304 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/301631
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI '99: Proceedings of the ACM SIGPLAN 1999 conference on Programming language design and implementation
        May 1999
        304 pages
        ISBN:1581130945
        DOI:10.1145/301618

      Copyright © 1999 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 May 1999

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader