In particular, the bug happens if the last line of a GPM template ends with a ';'. The work-around: remove that semicolon. That semicolon serves no purpose, so removing it won't cause problems.
The bug and the changes that led to it are discussed in
this thread.