We present a static analysis that detects potential runtime exceptions that are raised and never handled inside Standard ML (SML) programs. This analysis enhances the software safety by predicting, prior to the program execution, the abnormal termination caused by unhandled exceptions.
A prerequisite for a program's flow analysis is to estimate the program's control flow. In this thesis, program's control flow is computed simply based on the expression types from the SML/NJ compiler. From this call-graph information, program's exception flow is derived as a set of equations, whose solution is computed using the conventional iterative fixpoint method.
We have implemented the analysis prototype that analyzes SML program's {\tt absyn} representation inside SML/NJ 108.13. Our analysis can analyze programs written in the SML core, structures, and signatures. A prototype of this analysis is applied to some realistic SML programs and its cost- accuracy performance is promising for being used interactively. For example, it takes 23 seconds (contrary to 53 minutes by our earlier method) to analyze the ML-Lex program. The analysis reports that 5 exceptions may be uncaught. (The ML-Lex program has 10 exceptions, 19 raises, and 10 handlers.)