Adding a copyright notice to each file is unnecessary.
[oota-llvm.git] / docs / HowToSubmitABug.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><title>How to submit an LLVM bug report</title></head>
3
4 <body bgcolor=white>
5
6 <table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
7 <tr><td>&nbsp; <font size=+3 color="#EEEEFF" face="Georgia,Palatino,Times,Roman"><b>How to submit an LLVM bug report</b></font></td>
8 </tr></table>
9
10 <table border=0 width=100%>
11 <tr><td valign=top>
12 <p><font size=+1>
13 <ol>
14   <li><a href="#introduction">Introduction - Got bugs?</a>
15   <li><a href="#crashers">Crashing Bugs</a>
16     <ul>
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>
21     </ul>
22   <li><a href="#miscompilations">Miscompilations</a>
23
24   <p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></b><p>
25 </ol><p></font>
26 </td><td valign=top align=right>
27 <img src="Debugging.gif" width=444 height=314>
28 </td></tr>
29 </table>
30
31
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 <!-- *********************************************************************** -->
38
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
41 fixed quickly.<p>
42
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
48 more easily.<p>
49
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>
54
55 Thanks for helping us make LLVM better!<p>
56
57
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 <!-- *********************************************************************** -->
64
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>
71
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>
77 crashed.<p>
78
79 <ul>
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
87 have at this point.
88 </ul><p>
89
90
91 <!-- ======================================================================= -->
92 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
93 <tr><td>&nbsp;</td><td width="100%">&nbsp; 
94 <font color="#EEEEFF" face="Georgia,Palatino"><b>
95 <a name="front-end">Front-end bugs
96 </b></font></td></tr></table><ul>
97
98 If the problem is in the front-end, you should re-run the same
99 <tt>llvm-gcc</tt> command that resulted in the crash, but add the
100 <tt>-save-temps</tt> option.  The compiler will crash again, but it
101 will leave behind a <tt><i>foo</i>.i</tt> file (containing preprocessed
102 C source code) and possibly <tt><i>foo</i>.s</tt> (containing LLVM
103 assembly code), for each compiled <tt><i>foo</i>.c</tt> file. Send us
104 the <tt><i>foo</i>.i</tt> file, along with a brief description of the
105 error it caused.<p>
106
107 <!-- ======================================================================= -->
108 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
109 <tr><td>&nbsp;</td><td width="100%">&nbsp; 
110 <font color="#EEEEFF" face="Georgia,Palatino"><b>
111 <a name="gccas">GCCAS bugs
112 </b></font></td></tr></table><ul>
113
114 If you find that a bug crashes in the <tt><b>gccas</b></tt> stage of
115 compilation, compile your test-case to a <tt>.s</tt> file with the
116 <tt>-save-temps</tt> option to <tt><b>llvm-gcc</b></tt>. Then run:<p>
117
118 <pre>
119   <b>gccas</b> -debug-pass=Arguments &lt; /dev/null -o - &gt; /dev/null
120 </pre><p>
121
122 ... which will print a list of arguments, indicating the list of passes that
123 <tt><b>gccas</b></tt> runs.  Once you have the input file and the list of
124 passes, go to the section on <a href="#passes">debugging bugs in LLVM
125 passes</a>.<p>
126
127
128 <!-- ======================================================================= -->
129 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
130 <tr><td>&nbsp;</td><td width="100%">&nbsp; 
131 <font color="#EEEEFF" face="Georgia,Palatino"><b>
132 <a name="gccld">GCCLD bugs
133 </b></font></td></tr></table><ul>
134
135 If you find that a bug crashes in the <tt><b>gccld</b></tt> stage of
136 compilation, gather all of the <tt>.o</tt> bytecode files and libraries that are
137 being linked together (the "<tt><b>llvm-gcc</b> -v</tt>" output should include
138 the full list of objects linked).  Then run:<p>
139
140 <pre>
141   <b>as</b> &lt; /dev/null &gt; null.bc
142   <b>gccld</b> -debug-pass=Arguments null.bc
143 </pre><p>
144
145 ... which will print a list of arguments, indicating the list of passes that
146 <tt><b>gccld</b></tt> runs.  Once you have the input files and the list of
147 passes, go to the section on <a href="#passes">debugging bugs in LLVM
148 passes</a>.<p>
149
150 <!-- ======================================================================= -->
151 </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
152 <tr><td>&nbsp;</td><td width="100%">&nbsp; 
153 <font color="#EEEEFF" face="Georgia,Palatino"><b>
154 <a name="passes">Bugs in LLVM passes
155 </b></font></td></tr></table><ul>
156
157 At this point, you should have some number of LLVM assembly files or bytecode
158 files and a list of passes which crash when run on the specified input.  In
159 order to reduce the list of passes (which is probably large) and the input to
160 something tractable, use the <tt><b>bugpoint</b></tt> tool as follows:<p>
161
162 <pre>
163   <b>bugpoint</b> &lt;input files&gt; &lt;list of passes&gt;
164 </pre><p>
165
166 <tt><b>bugpoint</b></tt> will print a bunch of output as it reduces the
167 test-case, but it should eventually print something like this:<p>
168
169 <pre>
170   ...
171   Emitted bytecode to 'bugpoint-reduced-simplified.bc'
172
173   *** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm
174 </pre><p>
175
176 Once you complete this, please send the LLVM bytecode file and the command line
177 to reproduce the problem to the llvmbugs mailing list.<p>
178
179
180 <!-- *********************************************************************** -->
181 </ul><table width="100%" bgcolor="#330077" border=0 cellpadding=4 cellspacing=0>
182 <tr><td align=center><font color="#EEEEFF" size=+2 face="Georgia,Palatino"><b>
183 <a name="miscompilations">Miscompilations
184 </b></font></td></tr></table><ul>
185 <!-- *********************************************************************** -->
186
187 Fortunately we haven't had to many miscompilations.  Because of this, this
188 section is a TODO.  Basically, use bugpoint to track down the problem.<p>
189
190
191 <!-- *********************************************************************** -->
192 </ul>
193 <!-- *********************************************************************** -->
194
195 <hr><font size-1>
196 <address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
197 <!-- Created: Tue Aug  6 15:00:33 CDT 2002 -->
198 <!-- hhmts start -->
199 Last modified: Fri May 23 09:48:53 CDT 2003
200 <!-- hhmts end -->
201 </font></body></html>