1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><title>How to submit an LLVM bug report</title></head>
6 <table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
7 <tr><td> <font size=+3 color="#EEEEFF" face="Georgia,Palatino,Times,Roman"><b>How to submit an LLVM bug report</b></font></td>
10 <table border=0 width=100%>
14 <li><a href="#introduction">Introduction - Got bugs?</a>
15 <li><a href="#crashers">Crashing Bugs</a>
17 <li><a href="#front-end">Front-end bugs</a>
18 <li><a href="#gccas">GCCAS bugs</a>
19 <li><a href="#gccld">GCCLD bugs</a>
20 <li><a href="#passes">Bugs in LLVM passes</a>
22 <li><a href="#miscompilations">Miscompilations</a>
24 <p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></b><p>
26 </td><td valign=top align=right>
27 <img src="Debugging.gif" width=444 height=314>
32 <!-- *********************************************************************** -->
33 <table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
34 <tr><td align=center><font color="#EEEEFF" size=+2 face="Georgia,Palatino"><b>
35 <a name="introduction">Introduction - Got bugs?
36 </b></font></td></tr></table><ul>
37 <!-- *********************************************************************** -->
39 If you're working with LLVM and run into a bug, we definitely want to know about
40 it. This document describes what you can do to increase the odds of getting it
43 Basically you have to do two things at a minimum. First, decide whether the bug
44 <a href="#crashers">crashes the compiler</a> (or an LLVM pass), or if the
45 compiler is <a href="#miscompilations">miscompiling</a> the program. Based on
46 what type of bug it is, follow the instructions in the linked section to narrow
47 down the bug so that the person who fixes it will be able to find the problem
50 Once you have a reduced test-case, email information about the bug to: <a
51 href="mailto:llvmbugs@cs.uiuc.edu">llvmbugs@cs.uiuc.edu</a>. This should
52 include all of the information necessary to reproduce the problem, including
53 where you got the LLVM tree from (if you're not working out of CVS).<p>
55 Thanks for helping us make LLVM better!<p>
58 <!-- *********************************************************************** -->
59 </ul><table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
60 <tr><td align=center><font color="#EEEEFF" size=+2 face="Georgia,Palatino"><b>
61 <a name="crashers">Crashing Bugs
62 </b></font></td></tr></table><ul>
63 <!-- *********************************************************************** -->
65 More often than not, bugs in the compiler cause it to crash - often due to an
66 assertion failure of some sort. If you are running <tt><b>opt</b></tt> or
67 <tt><b>analyze</b></tt> directly, and something crashes, jump to the section on
68 <a href="#passes">bugs in LLVM passes</a>. Otherwise, the most important
69 piece of the puzzle is to figure out if it is the GCC-based front-end that is
70 buggy or if it's one of the LLVM tools that has problems.<p>
72 To figure out which program is crashing (the front-end, <tt><b>gccas</b></tt>,
73 or <tt><b>gccld</b></tt>), run the <tt><b>llvm-gcc</b></tt> command line as you
74 were when the crash occurred, but add a <tt>-v</tt> option to the command line.
75 The compiler will print out a bunch of stuff, and should end with telling you
76 that one of <tt><b>cc1</b></tt>, <tt><b>gccas</b></tt>, or <tt><b>gccld</b></tt>
80 <li>If <tt><b>cc1</b></tt> crashed, you found a problem with the front-end.
81 Jump ahead to the section on <a href="#front-end">front-end bugs</a>.
82 <li>If <tt><b>gccas</b></tt> crashed, you found a bug in <a href="#gccas">one of
83 the passes in <tt><b>gccas</b></tt></a>.
84 <li>If <tt><b>gccld</b></tt> crashed, you found a bug in <a href="#gccld">one
85 of the passes in <tt><b>gccld</b></tt></a>.
86 <li>Otherwise, something really weird happened. Email the list with what you
91 <!-- ======================================================================= -->
92 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
93 <tr><td> </td><td width="100%">
94 <font color="#EEEEFF" face="Georgia,Palatino"><b>
95 <a name="front-end">Front-end bugs
96 </b></font></td></tr></table><ul>
98 If the problem is in the front-end, pretty much the only thing you can do is
99 preprocess the input (compile with the <tt>-E</tt> option) and send us the
100 results. There is no good way to reduce source-level test-cases that I know
101 of... if you do know, send me information and we can extend this section. :)<p>
104 <!-- ======================================================================= -->
105 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
106 <tr><td> </td><td width="100%">
107 <font color="#EEEEFF" face="Georgia,Palatino"><b>
108 <a name="gccas">GCCAS bugs
109 </b></font></td></tr></table><ul>
111 If you find that a bug crashes in the <tt><b>gccas</b></tt> stage of
112 compilation, compile your test-case to a <tt>.s</tt> file with the <tt>-S</tt>
113 option to <tt><b>llvm-gcc</b></tt>. Then run:<p>
116 <b>gccas</b> -debug-pass=Arguments < /dev/null -o - > /dev/null
119 ... which will print a list of arguments, indicating the list of passes that
120 <tt><b>gccas</b></tt> runs. Once you have the input file and the list of
121 passes, go to the section on <a href="#passes">debugging bugs in LLVM
125 <!-- ======================================================================= -->
126 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
127 <tr><td> </td><td width="100%">
128 <font color="#EEEEFF" face="Georgia,Palatino"><b>
129 <a name="gccld">GCCLD bugs
130 </b></font></td></tr></table><ul>
132 If you find that a bug crashes in the <tt><b>gccld</b></tt> stage of
133 compilation, gather all of the <tt>.o</tt> bytecode files and libraries that are
134 being linked together (the "<tt><b>llvm-gcc</b> -v</tt>" output should include
135 the full list of objects linked). Then run:<p>
138 <b>gccld</b> -debug-pass=Arguments < /dev/null -o - > /dev/null
141 ... which will print a list of arguments, indicating the list of passes that
142 <tt><b>gccld</b></tt> runs. Once you have the input files and the list of
143 passes, go to the section on <a href="#passes">debugging bugs in LLVM
146 <!-- ======================================================================= -->
147 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
148 <tr><td> </td><td width="100%">
149 <font color="#EEEEFF" face="Georgia,Palatino"><b>
150 <a name="passes">Bugs in LLVM passes
151 </b></font></td></tr></table><ul>
153 At this point, you should have some number of LLVM assembly files or bytecode
154 files and a list of passes which crash when run on the specified input. In
155 order to reduce the list of passes (which is probably large) and the input to
156 something tractable, use the <tt><b>bugpoint</b></tt> tool as follows:<p>
159 <b>bugpoint</b> <input files> <list of passes>
162 <tt><b>bugpoint</b></tt> will print a bunch of output as it reduces the
163 test-case, but it should eventually print something like this:<p>
167 Emitted bytecode to 'bugpoint-reduced-simplified.bc'
169 *** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm
172 Once you complete this, please send the LLVM bytecode file and the command line
173 to reproduce the problem to the llvmbugs mailing list.<p>
176 <!-- *********************************************************************** -->
177 </ul><table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
178 <tr><td align=center><font color="#EEEEFF" size=+2 face="Georgia,Palatino"><b>
179 <a name="miscompilations">Miscompilations
180 </b></font></td></tr></table><ul>
181 <!-- *********************************************************************** -->
183 Fortunately we haven't had to many miscompilations. Because of this, this
184 section is a TODO. Basically, use bugpoint to track down the problem.<p>
187 <!-- *********************************************************************** -->
189 <!-- *********************************************************************** -->
192 <address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
193 <!-- Created: Tue Aug 6 15:00:33 CDT 2002 -->
195 Last modified: Wed May 21 17:20:13 CDT 2003
197 </font></body></html>