Segfault in a CoreLinted program (and a GHC-generated Core question)
Ben Gamari
ben at well-typed.com
Mon Oct 26 17:23:20 UTC 2015
Ömer Sinan Ağacan <omeragacan at gmail.com> writes:
> I have a very simple Core plugin that generates some functions. After my
> Core-to-Core pass is done, I'm running the linter to make sure the Core
> generated by my plugin is well-formed and well-typed. However, even though lint
> checker passes, the code generated by my plugin is failing with a segfault.
>
...
>
> So my questions are: Am I right in assuming that CoreLint accepted programs
> should not segfault? What about internal invariants? Should CoreLint check for
> those? Is there any pass that checks for invariants and prints helpful messages
> in case of a invariant invalidation?
>
My understanding is that CoreLint should (in principle) check all
internal invariants necessary to ensure the soundness of the Core. If a
Core program passes CoreLint it ought not to segfault. It sounds like
you found a bug in CoreLint.
> As an attempt at debugging the code generated by my plugin, I wrote the
> function that is supposed to be generated by my Core pass in Haskell and
> compiled with GHC. Generated Core is mostly the same, except at one point it
> has an extra lambda directly applied to a void#, something like ((\_ -> ...)
> void#). Where can I learn more about why GHC is doing that?
>
Hmm, interesting. I'm afraid I'm not sure what semantics void# has in
Core but it sure does sound fishy. Sadly grepping the source tree for
clues doesn't turn much up.
Simon, perhaps you could comment here?
Cheers,
- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151026/c8a9b326/attachment.sig>
More information about the ghc-devs
mailing list