The current version of Dynare defines all model local variables in generated c (and m) files, but then never actually uses them, instead substituting in the expression every time the model local variable appears.
Firstly, this makes the C compiler’s job a lot harder and will generally result in suboptimal code. It is a lot easier for compilers to optimise out variables than it is for them to create new variables for common expressions.
Secondly, for models with a lot of model local variables, perhaps defined recursively, this results in massive output files, which then crash the compiler. In order to facilitate finding the steady state of my model I created a static version of my model and put in model local variables where ever possible. This results in the current version of Dynare spitting out 350MB C/M files. If the model local variables were actually used rather than being substituted in these files would be more like 350KB…