| 1 | <html>
|
|---|
| 2 |
|
|---|
| 3 | <head>
|
|---|
| 4 | <title>GCC Bugs</title>
|
|---|
| 5 | </head>
|
|---|
| 6 |
|
|---|
| 7 | <body>
|
|---|
| 8 | <h1>GCC Bugs</h1>
|
|---|
| 9 |
|
|---|
| 10 | <p>The latest version of this document is always available at
|
|---|
| 11 | <a href="http://www.gnu.org/software/gcc/bugs.html">http://www.gnu.org/software/gcc/bugs.html</a>.</p>
|
|---|
| 12 |
|
|---|
| 13 | <hr />
|
|---|
| 14 |
|
|---|
| 15 | <h2>Table of Contents</h2>
|
|---|
| 16 | <ul>
|
|---|
| 17 | <li><a href="#report">Reporting Bugs</a>
|
|---|
| 18 | <ul>
|
|---|
| 19 | <li><a href="#need">What we need</a></li>
|
|---|
| 20 | <li><a href="#dontwant">What we DON'T want</a></li>
|
|---|
| 21 | <li><a href="#where">Where to post it</a></li>
|
|---|
| 22 | <li><a href="#detailed">Detailed bug reporting instructions</a></li>
|
|---|
| 23 | <li><a href="#gnat">Detailed bug reporting instructions for GNAT</a></li>
|
|---|
| 24 | <li><a href="#pch">Detailed bug reporting instructions when using a precompiled header</a></li>
|
|---|
| 25 | </ul>
|
|---|
| 26 | </li>
|
|---|
| 27 | <li><a href="#manage">Managing Bugs (GNATS and the test-suite)</a></li>
|
|---|
| 28 | <li><a href="#known">Frequently Reported Bugs in GCC</a>
|
|---|
| 29 | <ul>
|
|---|
| 30 | <li><a href="#general">General</a></li>
|
|---|
| 31 | <li><a href="#fortran">Fortran</a></li>
|
|---|
| 32 | <li><a href="#c">C</a></li>
|
|---|
| 33 | <li><a href="#cplusplus">C++</a>
|
|---|
| 34 | <ul>
|
|---|
| 35 | <li><a href="#updating">Common problems updating from G++ 2.95 to
|
|---|
| 36 | G++ 3.0</a></li>
|
|---|
| 37 | <li><a href="#nonbugs">Non-bugs</a></li>
|
|---|
| 38 | <li><a href="#missing">Missing features</a></li>
|
|---|
| 39 | <li><a href="#parsing">Parse errors for "simple" code</a></li>
|
|---|
| 40 | <li><a href="#-O3">Optimization at <code>-O3</code> takes a
|
|---|
| 41 | very long time</a></li>
|
|---|
| 42 | </ul>
|
|---|
| 43 | </li>
|
|---|
| 44 | </ul>
|
|---|
| 45 | </li>
|
|---|
| 46 | </ul>
|
|---|
| 47 |
|
|---|
| 48 | <hr />
|
|---|
| 49 |
|
|---|
| 50 | <h1><a name="report">Reporting Bugs</a></h1>
|
|---|
| 51 |
|
|---|
| 52 | <p>Our preferred way of receiving bugs is via the
|
|---|
| 53 | <a href="gnats.html">GCC GNATS bug reporting system</a>.</p>
|
|---|
| 54 |
|
|---|
| 55 | <p>Before you report a bug, please check the
|
|---|
| 56 | <a href="#known">list of well-known bugs</a> and, <strong>if possible
|
|---|
| 57 | in any way, try a current development snapshot</strong>.
|
|---|
| 58 | If you want to report a bug with versions of GCC before 3.1 we strongly
|
|---|
| 59 | recommend upgrading to the current release first.</p>
|
|---|
| 60 |
|
|---|
| 61 | <p>Before reporting that GCC compiles your code incorrectly, please
|
|---|
| 62 | compile it with <code>gcc -Wall</code> and see whether this shows
|
|---|
| 63 | anything wrong with your code that could be the cause instead of a bug
|
|---|
| 64 | in GCC.</p>
|
|---|
| 65 |
|
|---|
| 66 | <h2>Summarized bug reporting instructions</h2>
|
|---|
| 67 |
|
|---|
| 68 | <p>After this summary, you'll find detailed bug reporting
|
|---|
| 69 | instructions, that explain how to obtain some of the information
|
|---|
| 70 | requested in this summary.</p>
|
|---|
| 71 |
|
|---|
| 72 | <h3><a name="need">What we need</a></h3>
|
|---|
| 73 |
|
|---|
| 74 | Please include in your bug report all of the following items, the first
|
|---|
| 75 | three of which can be obtained from the output of <code>gcc -v</code>:
|
|---|
| 76 |
|
|---|
| 77 | <ul>
|
|---|
| 78 | <li>the exact version of GCC;</li>
|
|---|
| 79 | <li>the system type;</li>
|
|---|
| 80 | <li>the options given when GCC was configured/built;</li>
|
|---|
| 81 | <li>the complete command line that triggers the bug;</li>
|
|---|
| 82 | <li>the compiler output (error messages, warnings, etc.); and</li>
|
|---|
| 83 | <li>the <em>preprocessed</em> file (<code>*.i*</code>) that triggers the
|
|---|
| 84 | bug, generated by adding <code>-save-temps</code> to the complete
|
|---|
| 85 | compilation command, or, in the case of a bug report for the GNAT front end,
|
|---|
| 86 | a complete set of source files (see below).</li>
|
|---|
| 87 | </ul>
|
|---|
| 88 |
|
|---|
| 89 | <h3><a name="dontwant">What we do <strong>not</strong> want</a></h3>
|
|---|
| 90 |
|
|---|
| 91 | <ul>
|
|---|
| 92 | <li>A source file that <code>#include</code>s header files that are left
|
|---|
| 93 | out of the bug report (see above)</li>
|
|---|
| 94 |
|
|---|
| 95 | <li>That source file and a collection of header files.</li>
|
|---|
| 96 |
|
|---|
| 97 | <li>An attached archive (tar, zip, shar, whatever) containing all
|
|---|
| 98 | (or some :-) of the above.</li>
|
|---|
| 99 |
|
|---|
| 100 | <li>A code snippet that won't cause the compiler to produce the
|
|---|
| 101 | exact output mentioned in the bug report (e.g., a snippet with just
|
|---|
| 102 | a few lines around the one that <b>apparently</b> triggers the bug,
|
|---|
| 103 | with some pieces replaced with ellipses or comments for extra
|
|---|
| 104 | obfuscation :-)</li>
|
|---|
| 105 |
|
|---|
| 106 | <li>The location (URL) of the package that failed to build (we won't
|
|---|
| 107 | download it, anyway, since you've already given us what we need to
|
|---|
| 108 | duplicate the bug, haven't you? :-)</li>
|
|---|
| 109 |
|
|---|
| 110 | <li>An error that occurs only some of the times a certain file is
|
|---|
| 111 | compiled, such that retrying a sufficient number of times results in
|
|---|
| 112 | a successful compilation; this is a symptom of a hardware problem,
|
|---|
| 113 | not of a compiler bug (sorry)</li>
|
|---|
| 114 |
|
|---|
| 115 | <li>E-mail messages that complement previous, incomplete bug
|
|---|
| 116 | reports. Post a new, self-contained, full bug report instead, if
|
|---|
| 117 | possible as a follow-up to the original bug report</li>
|
|---|
| 118 |
|
|---|
| 119 | <li>Assembly files (<code>*.s</code>) produced by the compiler, or any
|
|---|
| 120 | binary files, such as object files, executables, core files, or
|
|---|
| 121 | precompiled header files</li>
|
|---|
| 122 |
|
|---|
| 123 | <li>Duplicate bug reports, or reports of bugs already fixed in the
|
|---|
| 124 | development tree, especially those that have already been reported
|
|---|
| 125 | as fixed last week :-)</li>
|
|---|
| 126 |
|
|---|
| 127 | <li>Bugs in the assembler, the linker or the C library. These are
|
|---|
| 128 | separate projects, with separate mailing lists and different bug
|
|---|
| 129 | reporting procedures</li>
|
|---|
| 130 |
|
|---|
| 131 | <li>Bugs in releases or snapshots of GCC not issued by the GNU
|
|---|
| 132 | Project. Report them to whoever provided you with the release</li>
|
|---|
| 133 |
|
|---|
| 134 | <li>Questions about the correctness or the expected behavior of
|
|---|
| 135 | certain constructs that are not GCC extensions. Ask them in forums
|
|---|
| 136 | dedicated to the discussion of the programming language</li>
|
|---|
| 137 | </ul>
|
|---|
| 138 |
|
|---|
| 139 | <h3><a name="where">Where to post it</a></h3>
|
|---|
| 140 |
|
|---|
| 141 | <p>Please submit your bug report directly to the
|
|---|
| 142 | <a href="gnats.html">GCC GNATS bug database</a>.
|
|---|
| 143 | Only if this is not possible, mail all information to
|
|---|
| 144 | <a href="mailto:[email protected]">[email protected]</a> or
|
|---|
| 145 | <a href="mailto:[email protected]">[email protected]</a>.</p>
|
|---|
| 146 |
|
|---|
| 147 | <p>The GCC lists have message size limits (200 kbytes) and bug reports
|
|---|
| 148 | over those limits will currently be bounced. If your bug is larger
|
|---|
| 149 | than that, please post it using the <a href="gnats.html">GCC GNATS bug
|
|---|
| 150 | database</a>.</p>
|
|---|
| 151 |
|
|---|
| 152 | <h2><a name="detailed">Detailed bug reporting instructions</a></h2>
|
|---|
| 153 |
|
|---|
| 154 | <p>Please refer to the <a href="#gnat">next section</a> when reporting
|
|---|
| 155 | bugs in GNAT, the Ada compiler, or to the <a href="#pch">one after
|
|---|
| 156 | that</a> when reporting bugs that appear when using a precompiled header.</p>
|
|---|
| 157 |
|
|---|
| 158 | <p>In general, all the information we need can be obtained by
|
|---|
| 159 | collecting the command line below, as well as its output and the
|
|---|
| 160 | preprocessed file it generates.</p>
|
|---|
| 161 |
|
|---|
| 162 | <blockquote><code>gcc -v -save-temps <i>all-your-options
|
|---|
| 163 | source-file</i></code></blockquote>
|
|---|
| 164 |
|
|---|
| 165 | <p>Typically the preprocessed file (extension <code>.i</code> for C or
|
|---|
| 166 | <code>.ii</code> for C++) will be large, so please compress the
|
|---|
| 167 | resulting file with one of the popular compression programs such as
|
|---|
| 168 | bzip2, gzip, zip or compress (in
|
|---|
| 169 | decreasing order of preference). Use maximum compression
|
|---|
| 170 | (<code>-9</code>) if available. Please include the compressed
|
|---|
| 171 | preprocessor output in your bug report, even if the source code is
|
|---|
| 172 | freely available elsewhere; it makes the job of our volunteer testers
|
|---|
| 173 | much easier.</p>
|
|---|
| 174 |
|
|---|
| 175 | <p>The <b>only</b> excuses to not send us the preprocessed sources are
|
|---|
| 176 | (i) if you've found a bug in the preprocessor, (ii) if you've reduced
|
|---|
| 177 | the testcase to a small file that doesn't include any other file or
|
|---|
| 178 | (iii) if the bug appears only when using precompiled headers. If you
|
|---|
| 179 | can't post the preprocessed sources because they're proprietary code,
|
|---|
| 180 | then try to create a small file that triggers the same problem.</p>
|
|---|
| 181 |
|
|---|
| 182 | <p>Since we're supposed to be able to re-create the assembly output
|
|---|
| 183 | (extension <code>.s</code>), you usually should not include
|
|---|
| 184 | it in the bug report, although you may want to post parts of it to
|
|---|
| 185 | point out assembly code you consider to be wrong.</p>
|
|---|
| 186 |
|
|---|
| 187 | <p>Whether to use MIME attachments or <code>uuencode</code> is up to
|
|---|
| 188 | you. In any case, make sure the compiler command line, version and
|
|---|
| 189 | error output are in plain text, so that we don't have to decode the
|
|---|
| 190 | bug report in order to tell who should take care of it. A meaningful
|
|---|
| 191 | subject indicating language and platform also helps.</p>
|
|---|
| 192 |
|
|---|
| 193 | <p>Please avoid posting an archive (.tar, .shar or .zip); we generally
|
|---|
| 194 | need just a single file to reproduce the bug (the .i/.ii preprocessed
|
|---|
| 195 | file), and, by storing it in an archive, you're just making our
|
|---|
| 196 | volunteers' jobs harder. Only when your bug report requires multiple
|
|---|
| 197 | source files to be reproduced should you use an archive. In any case,
|
|---|
| 198 | make sure the compiler version, error message, etc, are included in
|
|---|
| 199 | the body of your bug report as plain text, even if needlessly
|
|---|
| 200 | duplicated as part of an archive.</p>
|
|---|
| 201 |
|
|---|
| 202 | <p>If you fail to supply enough information for a bug report to be
|
|---|
| 203 | reproduced, someone will probably ask you to post additional
|
|---|
| 204 | information (or just ignore your bug report, if they're in a bad day,
|
|---|
| 205 | so try to get it right on the first posting :-). In this case, please
|
|---|
| 206 | post the additional information to the bug reporting mailing list, not
|
|---|
| 207 | just to the person who requested it, unless explicitly told so. If
|
|---|
| 208 | possible, please include in this follow-up all the information you had
|
|---|
| 209 | supplied in the incomplete bug report (including the preprocessor
|
|---|
| 210 | output), so that the new bug report is self-contained.</p>
|
|---|
| 211 |
|
|---|
| 212 | <h2><a name="gnat">Detailed bug reporting instructions for GNAT</a></h2>
|
|---|
| 213 |
|
|---|
| 214 | <p>See the <a href="#detailed">previous section</a> for bug reporting
|
|---|
| 215 | instructions for GCC language implementations other than Ada.</p>
|
|---|
| 216 |
|
|---|
| 217 | <p>Bug reports have to contain at least the following information in
|
|---|
| 218 | order to be useful:</p>
|
|---|
| 219 |
|
|---|
| 220 | <ul>
|
|---|
| 221 | <li>the exact version of GCC, as shown by "<code>gcc -v</code>";</li>
|
|---|
| 222 | <li>the system type;</li>
|
|---|
| 223 | <li>the options when GCC was configured/built;</li>
|
|---|
| 224 | <li>the exact command line passed to the <code>gcc</code> program
|
|---|
| 225 | triggering the bug
|
|---|
| 226 | (not just the flags passed to <code>gnatmake</code>, but
|
|---|
| 227 | <code>gnatmake</code> prints the parameters it passed to <code>gcc</code>)</li>
|
|---|
| 228 | <li>a collection of source files for reproducing the bug,
|
|---|
| 229 | preferably a minimal set (see below);</li>
|
|---|
| 230 | <li>a description of the expected behavior;</li>
|
|---|
| 231 | <li>a description of actual behavior.</li>
|
|---|
| 232 | </ul>
|
|---|
| 233 |
|
|---|
| 234 | <p>If your code depends on additional source files (usually package
|
|---|
| 235 | specifications), submit the source code for these compilation units in
|
|---|
| 236 | a single file that is acceptable input to <code>gnatchop</code>,
|
|---|
| 237 | i.e. contains no non-Ada text. If the compilation terminated
|
|---|
| 238 | normally, you can usually obtain a list of dependencies using the
|
|---|
| 239 | "<code>gnatls -d <i>main_unit</i></code>" command, where
|
|---|
| 240 | <code><i>main_unit</i></code> is the file name of the main compilation
|
|---|
| 241 | unit (which is also passed to <code>gcc</code>).</p>
|
|---|
| 242 |
|
|---|
| 243 | <p>If you report a bug which causes the compiler to print a bug box,
|
|---|
| 244 | include that bug box in your report, and do not forget to send all the
|
|---|
| 245 | source files listed after the bug box along with your report.</p>
|
|---|
| 246 |
|
|---|
| 247 | <p>If you use <code>gnatprep</code>, be sure to send in preprocessed
|
|---|
| 248 | sources (unless you have to report a bug in <code>gnatprep</code>).</p>
|
|---|
| 249 |
|
|---|
| 250 | <p>When you have checked that your report meets these criteria, please
|
|---|
| 251 | submit it according to our <a href="#where">generic instructions</a>.
|
|---|
| 252 | (If you use a mailing list for reporting, please include an
|
|---|
| 253 | "<code>[Ada]</code>" tag in the subject.)</p>
|
|---|
| 254 |
|
|---|
| 255 | <h2><a name="pch">Detailed bug reporting instructions when using a
|
|---|
| 256 | precompiled header</a></h2>
|
|---|
| 257 |
|
|---|
| 258 | <p>If you're encountering a bug when using a precompiled header, the
|
|---|
| 259 | first thing to do is to delete the precompiled header, and try running
|
|---|
| 260 | the same GCC command again. If the bug happens again, the bug doesn't
|
|---|
| 261 | really involve precompiled headers, please report it without using
|
|---|
| 262 | them by following the instructions <a href="#detailed">above</a>.</p>
|
|---|
| 263 |
|
|---|
| 264 | <p>If you've found a bug while <i>building</i> a precompiled header
|
|---|
| 265 | (for instance, the compiler crashes), follow the usual instructions
|
|---|
| 266 | <a href="#detailed">above</a>.</p>
|
|---|
| 267 |
|
|---|
| 268 | <p>If you've found a real precompiled header bug, what we'll need to
|
|---|
| 269 | reproduce it is the sources to build the precompiled header (as a
|
|---|
| 270 | single <code>.i</code> file), the source file that uses the
|
|---|
| 271 | precompiled header, any other headers that source file includes, and
|
|---|
|
|---|