How to submit an LLVM bug report

Introduction - Got bugs? Crashing Bugs Front-end bugs GCCAS bugs GCCLD bugs Bugs in LLVM passes Miscompilations Written by Chris Lattner |

Introduction - Got bugs?

If you're working with LLVM and run into a bug, we definitely want to know about it. This document describes what you can do to increase the odds of getting it fixed quickly.

Basically you have to do two things at a minimum. First, decide whether the bug crashes the compiler (or an LLVM pass), or if the compiler is miscompiling the program. Based on what type of bug it is, follow the instructions in the linked section to narrow down the bug so that the person who fixes it will be able to find the problem more easily.

Once you have a reduced test-case, email information about the bug to: llvmbugs@cs.uiuc.edu. This should include all of the information necessary to reproduce the problem, including where you got the LLVM tree from (if you're not working out of CVS).

Thanks for helping us make LLVM better!

Crashing Bugs

More often than not, bugs in the compiler cause it to crash - often due to an assertion failure of some sort. If you are running `opt` or `analyze` directly, and something crashes, jump to the section on bugs in LLVM passes. Otherwise, the most important piece of the puzzle is to figure out if it is the GCC-based front-end that is buggy or if it's one of the LLVM tools that has problems.

To figure out which program is crashing (the front-end, `gccas`, or `gccld`), run the `llvm-gcc` command line as you were when the crash occurred, but add a `-v` option to the command line. The compiler will print out a bunch of stuff, and should end with telling you that one of `cc1`, `gccas`, or `gccld` crashed.

- If `cc1` crashed, you found a problem with the front-end. Jump ahead to the section on front-end bugs.
- If `gccas` crashed, you found a bug in one of the passes in `gccas`.
- If `gccld` crashed, you found a bug in one of the passes in `gccld`.
- Otherwise, something really weird happened. Email the list with what you have at this point.

| Front-end bugs

If the problem is in the front-end, you should re-run the same `llvm-gcc` command that resulted in the crash, but add the `-save-temps` option. The compiler will crash again, but it will leave behind a `foo.i` file (containing preprocessed C source code) and possibly `foo.s` (containing LLVM assembly code), for each compiled `foo.c` file. Send us the `foo.i` file, along with a brief description of the error it caused.

| GCCAS bugs

If you find that a bug crashes in the `gccas` stage of compilation, compile your test-case to a `.s` file with the `-save-temps` option to `llvm-gcc`. Then run:

      gccas -debug-pass=Arguments < /dev/null -o - > /dev/null

... which will print a list of arguments, indicating the list of passes that `gccas` runs. Once you have the input file and the list of passes, go to the section on debugging bugs in LLVM passes.

| GCCLD bugs

If you find that a bug crashes in the `gccld` stage of compilation, gather all of the `.o` bytecode files and libraries that are being linked together (the "`llvm-gcc -v`" output should include the full list of objects linked). Then run:

      as < /dev/null > null.bc
      gccld -debug-pass=Arguments null.bc

... which will print a list of arguments, indicating the list of passes that `gccld` runs. Once you have the input files and the list of passes, go to the section on debugging bugs in LLVM passes.

| Bugs in LLVM passes

At this point, you should have some number of LLVM assembly files or bytecode files and a list of passes which crash when run on the specified input. In order to reduce the list of passes (which is probably large) and the input to something tractable, use the `bugpoint` tool as follows:

      bugpoint <input files> <list of passes>

`bugpoint` will print a bunch of output as it reduces the test-case, but it should eventually print something like this:

      ...
      Emitted bytecode to 'bugpoint-reduced-simplified.bc'

      *** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm

Once you complete this, please send the LLVM bytecode file and the command line to reproduce the problem to the llvmbugs mailing list.

Miscompilations

Fortunately we haven't had too many miscompilations. Because of this, this section is a TODO. Basically, use bugpoint to track down the problem.

Last modified: Fri May 23 09:48:53 CDT 2003