http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60334
--- Comment #2 from Antony Lewis <antony at cosmologist dot info> --- I looked for a while for a reproducible crash, which wasn't easy - mostly behaviour was errratic crashes - I was using 4.9 trunk from a week ago. But there was definitely a general problem with the code generated by this kind of construct with various compiler options: a module full of them crashed all over the place or gave erratic results (compiled with gfortran, it's fine with ifort). It again worked fine when I changed all the character function results and temporary variables to allocatables. (my guess was the code is mistakenly auto-freeing some charater pointers in the same way it does character allocatables). Happy to provide the more realistic test case if useful to testing.