Hello! Andrew - could you apply the proposed patch (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18682&action=view) and close bug 36560?
I can't immediately propose the test case for this bug but I've discovered this issue when tried to use Classpath Inflater/InflaterInputStream with OpenJDK PNGImageReader - on some legacy .png files a ZipException("Code lengths don't add up properly") was thrown while OpenJDK Inflater (based on zlib) worked correctly. The patch proposed by Daniel Noll solved my problem. Regards.