Tool for minimizing examples

Eric Crockett ecrockett0 at gmail.com
Wed Oct 26 04:27:11 UTC 2016


Devs: as I'm sure you know, the hardest part of reporting a GHC bug is
finding a minimal example that triggers the bug. When I initially trigger a
bug in my large code base, my workflow is something like:

 1. write a driver that triggers the bug
 2. do manual dead code elimination by removing unused files and functions
 3. "human required" step to figure out what can be trimmed to further
minimize
 4. go to step 2 until example is simple enouogh

Since I work on a large library (>60 modules) and also report a fair number
of bugs, I spend a nontrivial amount of time on step 2, which is completely
mechanical. It would be nice to have a tool that can help out.
Specifically, something that takes a "driver" file, and produces a copy of
the code contents to a new directory sans unimported files, and unused
functions from imported files.

Ideally, this tool would make a "closed universe" assumption so that
exported functions can also be eliminated as dead, if they are never used
elsewhere. A bonus feature would be to remove unused imports, and even
unused build-depends from the cabal file.

Are there any tools out there that can do any portion of this process for
me? Perhaps it is possible to output contents after the compiler does a DCE
pass?

Regards,
Eric Crockett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161026/941b47e8/attachment.html>


More information about the ghc-devs mailing list