ghc 8.4.1 and trac 13930

Evan Laforge qdunkan at gmail.com
Wed May 2 17:55:13 UTC 2018


On Wed, May 2, 2018 at 1:24 AM, Simon Peyton Jones
<simonpj at microsoft.com> wrote:
> |  I recently noticed that with -O1, ghc was optimizing some code
> |
> |      if Trace.traceShowId "b" $ True
> |          then ...
> |          else ...
> |
> |  to always evaluate the 'else' branch.
>
> Are you certain this is #13930?  I don't see an obvious connection.  It seems really really terrible to "optimise" True to False!
>
> I think #13930 was fixed by #5129, which in turn was about discarding a call to 'evaluate'.  That is different to turning True to False.
>
> But there's probably some more complicated context to your use-case that means my understanding is faulty.
>
> If you are confident that it's securely fixed, well and good. But when bugs disappear I always worry that they are still there, just concealed by some other change.

I'm not totally confident, which is I why I asked.  It does seem to be
related to the presence of Exception.evaluate, but it also comes and
goes depending on how many things are in the condition and branches.

It does seem to be gone in 8.4.1, but I'm also a bit nervous when I
don't know exactly why something was fixed.  I'll try to reduce this
to as small an expression as possible that still triggers True ->
False.


More information about the ghc-devs mailing list