Swift optimizer considered harmful

For some time I struggled with one weird bug reported to CryptoSwift. Few people report that sometimes they got mangled result of decryption with AES. Turn out the code that produce mangled output was PKCS7 class, with part responsible for removing padded bytes. this very function: public func remove(bytes:…