ideas for future work
To go further with the concept of a checking compiler, several extensions would be surely useful, among which:
Allowing a pattern to match expressions that are not top-level, or to match declarations.
Extending the Condate language with user-defined macros, e.g. set(x)="%X=%_" or ...
Implementing semantic patterns, in which a syntactic pattern
can be complemented by an executable predicate, e.g.
“%X=malloc(%S)” | { sizeof(X) > S }
This may be done
either by parsing executable C code embedded in Condate and linking
the result dynamically with gcc, or by embedding Condate in C, and
so writing checks directly as dynamic libraries. In both cases, the
libraries must have access to a well-defined interface, that should
be rather stable between different gcc versions.
One should take into account the side effects and alias information already computed within gcc when matching a “to” pattern, to check whether the “from”-matched expression was not side-effected in the mean time. If this is done, it becomes trivial to detect, for instance, common subexpressions: "from "%E" | TREE_EXPR(E) to "%E".
Give access within the (semantic part of the) pattern to the context of the pattern (its node, its edge).
On the theory side, it would be most useful to:
Characterize the kind of checks that can be expressed in Condate, especially in the presence of semantic patterns. This class surely contains an interesting class of "convergent" automata, which can model rules enforced by many existing libraries.
Perform several case studies on different existing libraries, to see how the current checks need to be enhanced, while keeping, if possible, their nice linear-time complexity.
Integrate in the language other kinds of traversal constraints, such as: follow only convergent/divergent edges, forward/backward edges (in the dataflow sense), etc. A possible application: detecting unpropagated constants: "from set(x) to use(x) avoid set(x) or converging(x)".
Got an idea, a suggestion? Are you interested in contributing? Your feedback can surely make the mygcc project even more exciting.
Last update: 14/4/2007. Contact: mygcc@free.fr