blob: e3f20197c15f309f2107f23adf9b1c68e9faebb3 [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
98If the problem is in the front-end, pretty much the only thing you can do is
99preprocess the input (compile with the <tt>-E</tt> option) and send us the
100results. There is no good way to reduce source-level test-cases that I know
101of... if you do know, send me information and we can extend this section. :)<p>
102
103
104<!-- ======================================================================= -->
105</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
106<tr><td>&nbsp;</td><td width="100%">&nbsp;
107<font color="#EEEEFF" face="Georgia,Palatino"><b>
108<a name="gccas">GCCAS bugs
109</b></font></td></tr></table><ul>
110
111If you find that a bug crashes in the <tt><b>gccas</b></tt> stage of
112compilation, compile your test-case to a <tt>.s</tt> file with the <tt>-S</tt>
113option to <tt><b>llvm-gcc</b></tt>. Then run:<p>
114
115<pre>
116 <b>gccas</b> -debug-pass=Arguments &lt; /dev/null -o - &gt; /dev/null
117</pre><p>
118
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
121passes, go to the section on <a href="#passes">debugging bugs in LLVM
122passes</a>.<p>
123
124
125<!-- ======================================================================= -->
126</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
127<tr><td>&nbsp;</td><td width="100%">&nbsp;
128<font color="#EEEEFF" face="Georgia,Palatino"><b>
129<a name="gccld">GCCLD bugs
130</b></font></td></tr></table><ul>
131
132If you find that a bug crashes in the <tt><b>gccld</b></tt> stage of
133compilation, gather all of the <tt>.o</tt> bytecode files and libraries that are
134being linked together (the "<tt><b>llvm-gcc</b> -v</tt>" output should include
135the full list of objects linked). Then run:<p>
136
137<pre>
138 <b>gccld</b> -debug-pass=Arguments &lt; /dev/null -o - &gt; /dev/null
139</pre><p>
140
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
143passes, go to the section on <a href="#passes">debugging bugs in LLVM
144passes</a>.<p>
145
146<!-- ======================================================================= -->
147</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
148<tr><td>&nbsp;</td><td width="100%">&nbsp;
149<font color="#EEEEFF" face="Georgia,Palatino"><b>
150<a name="passes">Bugs in LLVM passes
151</b></font></td></tr></table><ul>
152
153At this point, you should have some number of LLVM assembly files or bytecode
154files and a list of passes which crash when run on the specified input. In
155order to reduce the list of passes (which is probably large) and the input to
156something tractable, use the <tt><b>bugpoint</b></tt> tool as follows:<p>
157
158<pre>
159 <b>bugpoint</b> &lt;input files&gt; &lt;list of passes&gt;
160</pre><p>
161
162<tt><b>bugpoint</b></tt> will print a bunch of output as it reduces the
163test-case, but it should eventually print something like this:<p>
164
165<pre>
166 ...
167 Emitted bytecode to 'bugpoint-reduced-simplified.bc'
168
169 *** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm
170</pre><p>
171
172Once you complete this, please send the LLVM bytecode file and the command line
173to reproduce the problem to the llvmbugs mailing list.<p>
174
175
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<!-- *********************************************************************** -->
182
183Fortunately we haven't had to many miscompilations. Because of this, this
184section is a TODO. Basically, use bugpoint to track down the problem.<p>
185
186
187<!-- *********************************************************************** -->
188</ul>
189<!-- *********************************************************************** -->
190
191<hr><font size-1>
192<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
193<!-- Created: Tue Aug 6 15:00:33 CDT 2002 -->
194<!-- hhmts start -->
195Last modified: Wed May 21 17:20:13 CDT 2003
196<!-- hhmts end -->
197</font></body></html>