Tengo un corredor de prueba simple para el bug que está en mi módulo OpenPGP https://github.com/singpolyma/OpenPGP-Haskell/blob/master/Data/OpenPGP.hs:¿Por qué este código se comporta de manera diferente con optomisations encendido o apagado?
module Main where
import Data.OpenPGP
import Data.Binary (encode, decode)
packet = EmbeddedSignaturePacket (signaturePacket 2 168 ECDSA SHA256 [] [SignatureCreationTimePacket 1013401916,IssuerPacket "36FE856F4219F1C7"] 48065 [MPI 4,MPI 11,MPI 60,MPI 69,MPI 37,MPI 33,MPI 18,MPI 72,MPI 41,MPI 36,MPI 43,MPI 41,MPI 53,MPI 9,MPI 53,MPI 35,MPI 3,MPI 40,MPI 14,MPI 79,MPI 1,MPI 4,MPI 51,MPI 23,MPI 62,MPI 62,MPI 62,MPI 7,MPI 68,MPI 51,MPI 13,MPI 49,MPI 8,MPI 64,MPI 32,MPI 50,MPI 59,MPI 17,MPI 43,MPI 12,MPI 67,MPI 5,MPI 67,MPI 5,MPI 25,MPI 63,MPI 0,MPI 53,MPI 2,MPI 36,MPI 83,MPI 39,MPI 54,MPI 65,MPI 54,MPI 35,MPI 62,MPI 63,MPI 26,MPI 4,MPI 82,MPI 57,MPI 85,MPI 71,MPI 43,MPI 77])
main = print $ decode (encode packet) == packet
Si compila esto (en GHC 7.4.1) con:
ghc -O0 -fforce-recomp --make t.hs
Funciona como se esperaba (es decir, se imprime True
), pero si se compila como esto:
ghc -O1 -fforce-recomp --make t.hs
o esto:
ghc -O2 -fforce-recomp --make t.hs
Se imprimirá False
.
No estoy utilizando ninguna extensión (excepto un uso trivial de CPP) o llamadas de bajo nivel o inseguras, y el comportamiento debería ser de mi biblioteca y no una dependencia, ya que es solo mi código el que se recompila aquí .
Puedo reproducir este error en GHC 7.4.2 –
¿Estás usando binario o cereal cuando observas este error? –