190075Sobrien@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2132718Skan@c 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
390075Sobrien@c This is part of the GCC manual.
490075Sobrien@c For copying conditions, see the file gcc.texi.
590075Sobrien
690075Sobrien@node Bugs
790075Sobrien@chapter Reporting Bugs
890075Sobrien@cindex bugs
990075Sobrien@cindex reporting bugs
1090075Sobrien
1190075SobrienYour bug reports play an essential role in making GCC reliable.
1290075Sobrien
1390075SobrienWhen you encounter a problem, the first thing to do is to see if it is
1490075Sobrienalready known.  @xref{Trouble}.  If it isn't known, then you should
1590075Sobrienreport the problem.
1690075Sobrien
1790075Sobrien@menu
1890075Sobrien* Criteria:  Bug Criteria.   Have you really found a bug?
1990075Sobrien* Reporting: Bug Reporting.  How to report a bug effectively.
2090075Sobrien* Known: Trouble.            Known problems.
2190075Sobrien* Help: Service.             Where to ask for help.
2290075Sobrien@end menu
2390075Sobrien
24117395Skan@node Bug Criteria,Bug Reporting,,Bugs
2590075Sobrien@section Have You Found a Bug?
2690075Sobrien@cindex bug criteria
2790075Sobrien
2890075SobrienIf you are not sure whether you have found a bug, here are some guidelines:
2990075Sobrien
3090075Sobrien@itemize @bullet
3190075Sobrien@cindex fatal signal
3290075Sobrien@cindex core dump
3390075Sobrien@item
3490075SobrienIf the compiler gets a fatal signal, for any input whatever, that is a
3590075Sobriencompiler bug.  Reliable compilers never crash.
3690075Sobrien
3790075Sobrien@cindex invalid assembly code
3890075Sobrien@cindex assembly code, invalid
3990075Sobrien@item
4090075SobrienIf the compiler produces invalid assembly code, for any input whatever
4190075Sobrien(except an @code{asm} statement), that is a compiler bug, unless the
4290075Sobriencompiler reports errors (not just warnings) which would ordinarily
4390075Sobrienprevent the assembler from being run.
4490075Sobrien
4590075Sobrien@cindex undefined behavior
4690075Sobrien@cindex undefined function value
4790075Sobrien@cindex increment operators
4890075Sobrien@item
4990075SobrienIf the compiler produces valid assembly code that does not correctly
5090075Sobrienexecute the input source code, that is a compiler bug.
5190075Sobrien
52117395SkanHowever, you must double-check to make sure, because you may have a
53117395Skanprogram whose behavior is undefined, which happened by chance to give
54117395Skanthe desired results with another C or C++ compiler.
5590075Sobrien
5690075SobrienFor example, in many nonoptimizing compilers, you can write @samp{x;}
5790075Sobrienat the end of a function instead of @samp{return x;}, with the same
5890075Sobrienresults.  But the value of the function is undefined if @code{return}
5990075Sobrienis omitted; it is not a bug when GCC produces different results.
6090075Sobrien
6190075SobrienProblems often result from expressions with two increment operators,
6290075Sobrienas in @code{f (*p++, *p++)}.  Your previous compiler might have
6390075Sobrieninterpreted that expression the way you intended; GCC might
6490075Sobrieninterpret it another way.  Neither compiler is wrong.  The bug is
6590075Sobrienin your code.
6690075Sobrien
6790075SobrienAfter you have localized the error to a single source line, it should
6890075Sobrienbe easy to check for these things.  If your program is correct and
6990075Sobrienwell defined, you have found a compiler bug.
7090075Sobrien
7190075Sobrien@item
7290075SobrienIf the compiler produces an error message for valid input, that is a
7390075Sobriencompiler bug.
7490075Sobrien
7590075Sobrien@cindex invalid input
7690075Sobrien@item
7790075SobrienIf the compiler does not produce an error message for invalid input,
7890075Sobrienthat is a compiler bug.  However, you should note that your idea of
79132718Skan``invalid input'' might be someone else's idea of ``an extension'' or
80132718Skan``support for traditional practice''.
8190075Sobrien
8290075Sobrien@item
8390075SobrienIf you are an experienced user of one of the languages GCC supports, your
8490075Sobriensuggestions for improvement of GCC are welcome in any case.
8590075Sobrien@end itemize
8690075Sobrien
87117395Skan@node Bug Reporting,,Bug Criteria,Bugs
88117395Skan@section How and where to Report Bugs
8990075Sobrien@cindex compiler bugs, reporting
9090075Sobrien
91132718SkanBugs should be reported to the GCC bug database.  Please refer to
92117395Skan@uref{http://gcc.gnu.org/bugs.html} for up-to-date instructions how to
93117395Skansubmit bug reports.  Copies of this file in HTML (@file{bugs.html}) and
94117395Skanplain text (@file{BUGS}) are also part of GCC releases.
95