Abstract
One of the most common programming errors is the use of a variable before its definition. This undefined value may produce incorrect results, memory violations, unpredictable behaviors and program failure. To detect this kind of error, two approaches can be used: compile-time analysis and run-time checking. However, compile-time analysis is far from perfect because of complicated data and control flows as well as arrays with non-linear, indirection subscripts, etc. On the other hand, dynamic checking, although supported by hardware and compiler techniques, is costly due to heavy code instrumentation while information available at compile-time is not taken into account.
This paper presents a combination of an efficient compile-time analysis and a source code instrumentation for run-time checking. All kinds of variables are checked by PIPS, a Fortran research compiler for program analyses, transformation, parallelization and verification. Uninitialized array elements are detected by using imported array region, an efficient inter-procedural array data flow analysis. If exact array regions cannot be computed and compile-time information is not sufficient, array elements are initialized to a special value and their utilization is accompanied by a value test to assert the legality of the access. In comparison to the dynamic instrumentation, our method greatly reduces the number of variables to be initialized and to be checked. Code instrumentation is only needed for some array sections, not for the whole array. Tests are generated as early as possible. In addition, programs can be proved to be free from used-before-set errors statically at compile-time or, on the contrary, have real undefined errors. Experiments on SPEC95 CFP show encouraging results on analysis cost and run-time overheads.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Steensgaard, B.: Points-to analysis in almost linear time. In: ACM Symposium on Principles of Programming Languages, (1996) 32–41
Nguyen, T.V.N.: Efficient and Effiective Software Verifications for Scientific Applications using Static Analyses and Code Instrumentation. PhD thesis, Ecole des Mines de Paris (2002)
Loginov, A., Yong, S.H., Horwitz, S., and Reps, T.W.: Debugging via run-time type checking. In Fundamental Approaches to Software Engineering (2001) 217–232
Appleyard, J.: Comparing Fortran compilers. ACM SIGPLAN-Fortran Forum 20 (2001) 6–10
Hasting, R., Joyce, B.: Purify: fast detection of memory leaks and access errors. In: Winter USENIX Conference (1992) 125–136
Evans, D., Guttag, J., Horning, J., Tan, Y.M.: LCLint: A tool for using specifications to check code. In: ACM SIGSOFT Symposium on Foundations of Software Engineering (1994) 87–96
Reps, T., Horwitz, S., Sagiv, M.: Precise interprocedural dataflow analysis via graph reachability. In: ACM Symposium on Principles of Programming Languages (1995) 49–61
Feautrier, P.: Dataflow analysis of array and scalar references. International Journal of Parallel Programming 20 (1991) 23–53
Irigoin, F., Jouvelot, P., Triolet, R.: Semantical interprocedural parallelization: an overview of the PIPS project. In: International Conference on Supercomputing (1991) 144–151
Creusillet, B., Irigoin, F.: Interprocedural array region analyses. In: International Workshop on Languages and Compilers for Parallel Computing. Volume 1033 of Lecture Notes in Computer Science, Springer-Verlag (1995) 46–60
Schrijver, A.: Theory of Linear and Integer Programming. John Wiley & Sons, Chichester (1986).
Creusillet, B.: IN and OUT array region analyses. In: Workshop on Compilers for Parallel Computers. (1995) 233–246
ANSI: Programming Language FORTRAN, ANSI X3.9-1978, ISO 1539-1980. American National Standard Institute, New York (1983).
Duesterwald, E., Gupta, R., Soffa, M.L.: A practical data flow framework for array reference analysis and its application in optimization. In: ACM SIGPLAN Conference on Programming Language Design and Implementation (1993) 68–77
Hall, M.W., Amarasinghe, S.P., Murphy, B.R., Liao, S.W., Lam, M.S.: Detecting coarse-grain parallelism using an interprocedural parallelizing compiler. Super-Computing(1995)
Gu, J., Li, Z., Lee, G.: Symbolic array dataflow analysis for array privatization and program parallelization. In: Supercomputing (1995)
Tu, P., Padua, D.A.: Gated SSA-based demand-driven symbolic analysis for parallelizing compilers. In: International Conference on Supercomputing (1995)414–423
Duesterwald, E., Gupta, R., Soffa, M.L.: Demand-driven computation of interprocedural data flow. In: ACM Symposium on Principles of Programming Languages (1995) 37–48
Leservot, A.: Analyses interprocédurales du flot des données. PhD thesis, Université Paris VI (1996)
Triolet, R., Feautrier, P., Irigoin, F.: Automatic parallelization of Fortran programs in the presence of procedure calls. In: European Symposium on Programming (1986)
Ancourt, C., Irigoin, F.: Scanning polyhedra with DO loops. In: ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (1991) 39–50
Dujmovic, J.J., Dujmovic, I.: Evolution and evaluation of SPEC benchmarks. ACM SIGMETRICS 26 (1998) 2–9
Bourdoncle, F.: Sémantiques des langages impératifs d’ordre supérieur et interpr étation abstraite. PhD thesis, Ecole Polytechnique, France (1992)
Manjunathaiah, M., Nicole, D.A.: Precise analysis of array usage in scientific programs. Scientific Programming 6 (1997) 229–242
Ami, T.L., Reps, T., Sagiv, L., Wilhelm, R.: Putting static analysis to work for verification: A case study. In: International Symposium on Software Testing and Analysis, (2000) 26–38
Arnold, M., Ryder, B.G.: A framework for reducing the cost of instrumented code. In: ACM SIGPLAN Conference on Programming Language Design and Implementation (2001) 168–179
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Nguyen, T.V.N., Irigoin, F., Ancourt, C., Coelho, F. (2003). Automatic Detection of Uninitialized Variables. In: Hedin, G. (eds) Compiler Construction. CC 2003. Lecture Notes in Computer Science, vol 2622. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-36579-6_16
Download citation
DOI: https://doi.org/10.1007/3-540-36579-6_16
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-00904-7
Online ISBN: 978-3-540-36579-2
eBook Packages: Springer Book Archive