According to PDF documentation, 'q [some code] Q' used 'inside' path shouldn't change the current path (unlike in PostScript). In Ghostscript this behaviour is defined in lib/pdf_ops.ps (/grestore_nopath). But if you change CTM between 'q' & 'Q', you will get unexpected effect: after the `Q' operator the applied transformation changes the existing path. I uploaded short PDF (nearly minimal example) with such construction, and the results of rendering it in Ghostscript and Acrobat Reader.
Created attachment 3980 [details] Example PDF
Created attachment 3981 [details] Ghostscript interpretation of example
Created attachment 3982 [details] Adobe Reader screenshot of example
Fix and simplify implementation of operator Q. Collecting the path with the current ctm and re-playing it with the restored ctm transforms the path exactly as PDF needs. The following patch is committed as a rev. 8707. http://ghostscript.com/pipermail/gs-cvs/2008-May/008288.html Current regression testing shows no differences. The sample file from this bug will be added to the public test suite by the next revision.