Tool for minimizing examples

Simon Peyton Jones simonpj at microsoft.com
Wed Oct 26 07:21:40 UTC 2016


Great question.

And just to add: I _really_ appreciate the fact that you make small examples.  Thank you.

Simon

From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Eric Crockett
Sent: 26 October 2016 05:27
To: ghc-devs <ghc-devs at haskell.org>
Subject: Tool for minimizing examples

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/1b81d7a8/attachment-0001.html>


More information about the ghc-devs mailing list