The gfortran front end to gcc reads in the source code and converts it to an abstract syntax tree, which is then converted to an intermediate representation which gcc then further optimizes and converts into assembler. However, there are certain optimizations that require knowledge of Fortran semantics and which are better handled at the level of the abstract syntax tree because the rest of the compiler is language-agnostic. In other words, the compiler rewrites the source code representation to something that the user ought to have written.
This presentation gives an overview of what transformations are currently done, how their effect can be controlled by the user and what future developments might be. On that last point, input from the community is highly welcome.