blob: fecd1afd9ce63e7811d36cf1d695a997c6f222d8 [file] [log] [blame]
Chris Lattner8b6be362003-05-21 22:21:07 +00001<!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
39If you're working with LLVM and run into a bug, we definitely want to know about
40it. This document describes what you can do to increase the odds of getting it
41fixed quickly.<p>
42
43Basically 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
45compiler is <a href="#miscompilations">miscompiling</a> the program. Based on
46what type of bug it is, follow the instructions in the linked section to narrow
47down the bug so that the person who fixes it will be able to find the problem
48more easily.<p>
49
50Once you have a reduced test-case, email information about the bug to: <a
51href="mailto:llvmbugs@cs.uiuc.edu">llvmbugs@cs.uiuc.edu</a>. This should
52include all of the information necessary to reproduce the problem, including
53where you got the LLVM tree from (if you're not working out of CVS).<p>
54
55Thanks 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
65More often than not, bugs in the compiler cause it to crash - often due to an
66assertion 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
69piece of the puzzle is to figure out if it is the GCC-based front-end that is
70buggy or if it's one of the LLVM tools that has problems.<p>
71
72To figure out which program is crashing (the front-end, <tt><b>gccas</b></tt>,
73or <tt><b>gccld</b></tt>), run the <tt><b>llvm-gcc</b></tt> command line as you
74were when the crash occurred, but add a <tt>-v</tt> option to the command line.
75The compiler will print out a bunch of stuff, and should end with telling you
76that one of <tt><b>cc1</b></tt>, <tt><b>gccas</b></tt>, or <tt><b>gccld</b></tt>
77crashed.<p>
78
79<ul>
80<li>If <tt><b>cc1</b></tt> crashed, you found a problem with the front-end.
81Jump 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
83the 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
85of the passes in <tt><b>gccld</b></tt></a>.
86<li>Otherwise, something really weird happened. Email the list with what you
87have 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
Brian Gaekeeefe9792003-05-23 21:03:50 +000098If 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
101will leave behind a <tt><i>foo</i>.i</tt> file (containing preprocessed
102C source code) and possibly <tt><i>foo</i>.s</tt> (containing LLVM
103assembly code), for each compiled <tt><i>foo</i>.c</tt> file. Send us
104the <tt><i>foo</i>.i</tt> file, along with a brief description of the
105error it caused.<p>
Chris Lattner8b6be362003-05-21 22:21:07 +0000106
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
114If you find that a bug crashes in the <tt><b>gccas</b></tt> stage of
Brian Gaekeeefe9792003-05-23 21:03:50 +0000115compilation, 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>
Chris Lattner8b6be362003-05-21 22:21:07 +0000117
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
124passes, go to the section on <a href="#passes">debugging bugs in LLVM
125passes</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
135If you find that a bug crashes in the <tt><b>gccld</b></tt> stage of
136compilation, gather all of the <tt>.o</tt> bytecode files and libraries that are
137being linked together (the "<tt><b>llvm-gcc</b> -v</tt>" output should include
138the full list of objects linked). Then run:<p>
139
140<pre>
Chris Lattnerddaf5002003-05-23 14:49:32 +0000141 <b>as</b> &lt; /dev/null &gt; null.bc
142 <b>gccld</b> -debug-pass=Arguments null.bc
Chris Lattner8b6be362003-05-21 22:21:07 +0000143</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
147passes, go to the section on <a href="#passes">debugging bugs in LLVM
148passes</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
157At this point, you should have some number of LLVM assembly files or bytecode
158files and a list of passes which crash when run on the specified input. In
159order to reduce the list of passes (which is probably large) and the input to
160something 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
167test-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
176Once you complete this, please send the LLVM bytecode file and the command line
177to 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
Chris Lattner390e3c32003-08-24 17:30:55 +0000187Fortunately we haven't had too many miscompilations. Because of this, this
Chris Lattner8b6be362003-05-21 22:21:07 +0000188section 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 -->
Chris Lattnerddaf5002003-05-23 14:49:32 +0000199Last modified: Fri May 23 09:48:53 CDT 2003
Chris Lattner8b6be362003-05-21 22:21:07 +0000200<!-- hhmts end -->
201</font></body></html>