| 1 |
@c Copyright (C) 1988-2023 Free Software Foundation, Inc. |
| 2 |
@c This is part of the GCC manual. |
| 3 |
@c For copying conditions, see the file gcc.texi. |
| 4 |
|
| 5 |
@node Bugs |
| 6 |
@chapter Reporting Bugs |
| 7 |
@cindex bugs |
| 8 |
@cindex reporting bugs |
| 9 |
|
| 10 |
Your bug reports play an essential role in making GCC reliable. |
| 11 |
|
| 12 |
When you encounter a problem, the first thing to do is to see if it is |
| 13 |
already known. @xref{Trouble}. If it isn't known, then you should |
| 14 |
report the problem. |
| 15 |
|
| 16 |
@menu |
| 17 |
* Criteria: Bug Criteria. Have you really found a bug? |
| 18 |
* Reporting: Bug Reporting. How to report a bug effectively. |
| 19 |
@end menu |
| 20 |
|
| 21 |
@node Bug Criteria |
| 22 |
@section Have You Found a Bug? |
| 23 |
@cindex bug criteria |
| 24 |
|
| 25 |
If you are not sure whether you have found a bug, here are some guidelines: |
| 26 |
|
| 27 |
@itemize @bullet |
| 28 |
@cindex fatal signal |
| 29 |
@cindex core dump |
| 30 |
@item |
| 31 |
If the compiler gets a fatal signal, for any input whatever, that is a |
| 32 |
compiler bug. Reliable compilers never crash. |
| 33 |
|
| 34 |
@cindex invalid assembly code |
| 35 |
@cindex assembly code, invalid |
| 36 |
@item |
| 37 |
If the compiler produces invalid assembly code, for any input whatever |
| 38 |
(except an @code{asm} statement), that is a compiler bug, unless the |
| 39 |
compiler reports errors (not just warnings) which would ordinarily |
| 40 |
prevent the assembler from being run. |
| 41 |
|
| 42 |
@cindex undefined behavior |
| 43 |
@cindex undefined function value |
| 44 |
@cindex increment operators |
| 45 |
@item |
| 46 |
If the compiler produces valid assembly code that does not correctly |
| 47 |
execute the input source code, that is a compiler bug. |
| 48 |
|
| 49 |
However, you must double-check to make sure, because you may have a |
| 50 |
program whose behavior is undefined, which happened by chance to give |
| 51 |
the desired results with another C or C++ compiler. |
| 52 |
|
| 53 |
For example, in many nonoptimizing compilers, you can write @samp{x;} |
| 54 |
at the end of a function instead of @samp{return x;}, with the same |
| 55 |
results. But the value of the function is undefined if @code{return} |
| 56 |
is omitted; it is not a bug when GCC produces different results. |
| 57 |
|
| 58 |
Problems often result from expressions with two increment operators, |
| 59 |
as in @code{f (*p++, *p++)}. Your previous compiler might have |
| 60 |
interpreted that expression the way you intended; GCC might |
| 61 |
interpret it another way. Neither compiler is wrong. The bug is |
| 62 |
in your code. |
| 63 |
|
| 64 |
After you have localized the error to a single source line, it should |
| 65 |
be easy to check for these things. If your program is correct and |
| 66 |
well defined, you have found a compiler bug. |
| 67 |
|
| 68 |
@item |
| 69 |
If the compiler produces an error message for valid input, that is a |
| 70 |
compiler bug. |
| 71 |
|
| 72 |
@cindex invalid input |
| 73 |
@item |
| 74 |
If the compiler does not produce an error message for invalid input, |
| 75 |
that is a compiler bug. However, you should note that your idea of |
| 76 |
``invalid input'' might be someone else's idea of ``an extension'' or |
| 77 |
``support for traditional practice''. |
| 78 |
|
| 79 |
@item |
| 80 |
If you are an experienced user of one of the languages GCC supports, your |
| 81 |
suggestions for improvement of GCC are welcome in any case. |
| 82 |
@end itemize |
| 83 |
|
| 84 |
@node Bug Reporting |
| 85 |
@section How and Where to Report Bugs |
| 86 |
@cindex compiler bugs, reporting |
| 87 |
|
| 88 |
Bugs should be reported to the bug database at @value{BUGURL}. |