1*ec02198aSmrg@c Copyright (C) 1988-2020 Free Software Foundation, Inc.
210d565efSmrg@c This is part of the GCC manual.
310d565efSmrg@c For copying conditions, see the file gcc.texi.
410d565efSmrg
510d565efSmrg@node Bugs
610d565efSmrg@chapter Reporting Bugs
710d565efSmrg@cindex bugs
810d565efSmrg@cindex reporting bugs
910d565efSmrg
1010d565efSmrgYour bug reports play an essential role in making GCC reliable.
1110d565efSmrg
1210d565efSmrgWhen you encounter a problem, the first thing to do is to see if it is
1310d565efSmrgalready known.  @xref{Trouble}.  If it isn't known, then you should
1410d565efSmrgreport the problem.
1510d565efSmrg
1610d565efSmrg@menu
1710d565efSmrg* Criteria:  Bug Criteria.   Have you really found a bug?
1810d565efSmrg* Reporting: Bug Reporting.  How to report a bug effectively.
1910d565efSmrg@end menu
2010d565efSmrg
2110d565efSmrg@node Bug Criteria
2210d565efSmrg@section Have You Found a Bug?
2310d565efSmrg@cindex bug criteria
2410d565efSmrg
2510d565efSmrgIf you are not sure whether you have found a bug, here are some guidelines:
2610d565efSmrg
2710d565efSmrg@itemize @bullet
2810d565efSmrg@cindex fatal signal
2910d565efSmrg@cindex core dump
3010d565efSmrg@item
3110d565efSmrgIf the compiler gets a fatal signal, for any input whatever, that is a
3210d565efSmrgcompiler bug.  Reliable compilers never crash.
3310d565efSmrg
3410d565efSmrg@cindex invalid assembly code
3510d565efSmrg@cindex assembly code, invalid
3610d565efSmrg@item
3710d565efSmrgIf the compiler produces invalid assembly code, for any input whatever
3810d565efSmrg(except an @code{asm} statement), that is a compiler bug, unless the
3910d565efSmrgcompiler reports errors (not just warnings) which would ordinarily
4010d565efSmrgprevent the assembler from being run.
4110d565efSmrg
4210d565efSmrg@cindex undefined behavior
4310d565efSmrg@cindex undefined function value
4410d565efSmrg@cindex increment operators
4510d565efSmrg@item
4610d565efSmrgIf the compiler produces valid assembly code that does not correctly
4710d565efSmrgexecute the input source code, that is a compiler bug.
4810d565efSmrg
4910d565efSmrgHowever, you must double-check to make sure, because you may have a
5010d565efSmrgprogram whose behavior is undefined, which happened by chance to give
5110d565efSmrgthe desired results with another C or C++ compiler.
5210d565efSmrg
5310d565efSmrgFor example, in many nonoptimizing compilers, you can write @samp{x;}
5410d565efSmrgat the end of a function instead of @samp{return x;}, with the same
5510d565efSmrgresults.  But the value of the function is undefined if @code{return}
5610d565efSmrgis omitted; it is not a bug when GCC produces different results.
5710d565efSmrg
5810d565efSmrgProblems often result from expressions with two increment operators,
5910d565efSmrgas in @code{f (*p++, *p++)}.  Your previous compiler might have
6010d565efSmrginterpreted that expression the way you intended; GCC might
6110d565efSmrginterpret it another way.  Neither compiler is wrong.  The bug is
6210d565efSmrgin your code.
6310d565efSmrg
6410d565efSmrgAfter you have localized the error to a single source line, it should
6510d565efSmrgbe easy to check for these things.  If your program is correct and
6610d565efSmrgwell defined, you have found a compiler bug.
6710d565efSmrg
6810d565efSmrg@item
6910d565efSmrgIf the compiler produces an error message for valid input, that is a
7010d565efSmrgcompiler bug.
7110d565efSmrg
7210d565efSmrg@cindex invalid input
7310d565efSmrg@item
7410d565efSmrgIf the compiler does not produce an error message for invalid input,
7510d565efSmrgthat is a compiler bug.  However, you should note that your idea of
7610d565efSmrg``invalid input'' might be someone else's idea of ``an extension'' or
7710d565efSmrg``support for traditional practice''.
7810d565efSmrg
7910d565efSmrg@item
8010d565efSmrgIf you are an experienced user of one of the languages GCC supports, your
8110d565efSmrgsuggestions for improvement of GCC are welcome in any case.
8210d565efSmrg@end itemize
8310d565efSmrg
8410d565efSmrg@node Bug Reporting
8510d565efSmrg@section How and Where to Report Bugs
8610d565efSmrg@cindex compiler bugs, reporting
8710d565efSmrg
8810d565efSmrgBugs should be reported to the bug database at @value{BUGURL}.
89