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