Tool for minimizing examples

Edward Z. Yang ezyang at mit.edu
Wed Oct 26 06:28:55 UTC 2016


I asked about this on Twitter a while back
<https://twitter.com/johnregehr/status/768693836616912898> and John
Regehr suggested that we give C-reduce a try.  I have not
yet but if you try it out I'm quite curious to see what
happens.

Edward

Excerpts from Eric Crockett's message of 2016-10-26 00:27:11 -0400:
> 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


More information about the ghc-devs mailing list