Thanks gcc for the report and vajrasky for the patch. Backport of 570d9c2678d6cc564f9c70138554af8f7ce9ec49 from master.