home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / c / gnu_c / docs / bugs < prev    next >
Encoding:
Text File  |  1996-03-15  |  10.6 KB  |  232 lines

  1. Reporting Bugs
  2. **************
  3.  
  4.    Your bug reports play an essential role in making GNU CC reliable.
  5.  
  6.    When you encounter a problem, the first thing to do is to see if it
  7. is already known.  If it isn't known, then you should report the problem.
  8.  
  9.    Reporting a bug may help you by bringing a solution to your problem,
  10. or it may not.  In any case, the principal function of a bug report
  11. is to help the entire community by making the next version of GNU CC
  12. work better.  Bug reports are your contribution to the maintenance of
  13. GNU CC.
  14.  
  15.    Since the maintainers are very overloaded, we cannot respond to every
  16. bug report, although we will try to cure as many as possible.
  17.  
  18.    In order for a bug report to serve its purpose, you must include the
  19. information that makes for fixing the bug.
  20.  
  21. Have You Found a Bug?
  22. =====================
  23.  
  24.    If you are not sure whether you have found a bug, here are some
  25. guidelines:
  26.  
  27.    * If the compiler gets a fatal signal, for any input whatever, that
  28.      is a compiler bug.  Reliable compilers never crash.
  29.  
  30.    * If the compiler produces invalid assembly code, for any input
  31.      whatever (except an `asm' statement), that is a compiler bug,
  32.      unless the compiler reports errors (not just warnings) which would
  33.      ordinarily prevent the assembler from being run.
  34.  
  35.    * If the compiler produces valid assembly code that does not
  36.      correctly execute the input source code, that is a compiler bug.
  37.  
  38.      However, you must double-check to make sure, because you may have
  39.      run into an incompatibility between GNU C and traditional C.  These
  40.      incompatibilities might be considered bugs, but they are inescapable
  41.      consequences of valuable features.
  42.  
  43.      Or you may have a program whose behavior is undefined, which
  44.      happened by chance to give the desired results with another C or
  45.      C++ compiler.
  46.  
  47.      For example, in many nonoptimizing compilers, you can write `x;'
  48.      at the end of a function instead of `return x;', with the same
  49.      results.  But the value of the function is undefined if `return'
  50.      is omitted; it is not a bug when GNU CC produces different results.
  51.  
  52.      Problems often result from expressions with two increment
  53.      operators, as in `f (*p++, *p++)'.  Your previous compiler might
  54.      have interpreted that expression the way you intended; GNU CC might
  55.      interpret it another way.  Neither compiler is wrong.  The bug is
  56.      in your code.
  57.  
  58.      After you have localized the error to a single source line, it
  59.      should be easy to check for these things.  If your program is
  60.      correct and well defined, you have found a compiler bug.
  61.  
  62.    * If the compiler produces an error message for valid input, that is
  63.      a compiler bug.
  64.  
  65.    * If the compiler does not produce an error message for invalid
  66.      input, that is a compiler bug.  However, you should note that your
  67.      idea of "invalid input" might be my idea of "an extension" or
  68.      "support for traditional practice".
  69.  
  70.    * If you are an experienced user of C or C++ compilers, your
  71.      suggestions for improvement of GNU CC or GNU C++ are welcome in
  72.      any case.
  73.  
  74. Where to Report Bugs
  75. ====================
  76.  
  77.    Send bug reports for GNU C to n.a.burrett@mcs.salford.ac.uk.
  78.  
  79.    Send bug reports for GNU C++ to n.a.burrett@mcs.salford.ac.uk.  If your
  80. bug involves the C++ class library libg++, send mail to
  81. bug-lib-g++@prep.ai.mit.edu.  If you're not sure, you can send the
  82. bug report to both addresses.
  83.  
  84.    *Do not send bug reports to `help-gcc@prep.ai.mit.edu' or to the
  85. newsgroup `gnu.gcc.help'.* Most users of GNU CC do not want to receive
  86. bug reports.
  87.  
  88.  
  89. How to Report Bugs
  90. ==================
  91.  
  92.    The fundamental principle of reporting bugs usefully is this:
  93. *report all the facts*.  If you are not sure whether to state a fact or
  94. leave it out, state it!
  95.  
  96.    Often people omit facts because they think they know what causes the
  97. problem and they conclude that some details don't matter.  Thus, you
  98. might assume that the name of the variable you use in an example does
  99. not matter.  Well, probably it doesn't, but one cannot be sure.
  100. Perhaps the bug is a stray memory reference which happens to fetch from
  101. the location where that name is stored in memory; perhaps, if the name
  102. were different, the contents of that location would fool the compiler
  103. into doing the right thing despite the bug.  Play it safe and give a
  104. specific, complete example.  That is the easiest thing for you to do,
  105. and the most helpful.
  106.  
  107.    Keep in mind that the purpose of a bug report is to enable someone to
  108. fix the bug if it is not known.  It isn't very important what happens if
  109. the bug is already known.  Therefore, always write your bug reports on
  110. the assumption that the bug is not known.
  111.  
  112.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  113. bell?"  This cannot help us fix a bug, so it is basically useless.  We
  114. respond by asking for enough details to enable us to investigate.  You
  115. might as well expedite matters by sending them to begin with.
  116.  
  117.    Try to make your bug report self-contained.  If we have to ask you
  118. for more information, it is best if you include all the previous
  119. information in your response, as well as the information that was
  120. missing.
  121.  
  122.    Please report each bug in a separate message.  This makes it easier
  123. for us to track which bugs have been fixed and to forward your bugs
  124. reports to the appropriate maintainer.
  125.  
  126.    To enable someone to investigate the bug, you should include all
  127. these things:
  128.  
  129.    * The version of GNU CC.  You can get this by running it with the
  130.      `-v' option.
  131.  
  132.      Without this, we won't know whether there is any point in looking
  133.      for the bug in the current version of GNU CC.
  134.  
  135.    * A complete input file that will reproduce the bug.  If the bug is
  136.      in the C preprocessor, send a source file and any header files
  137.      that it requires.  If the bug is in the compiler proper (`cc1'),
  138.      run your source file through the C preprocessor by doing `gcc -E
  139.      SOURCEFILE > OUTFILE', then include the contents of OUTFILE in the
  140.      bug report.  (When you do this, use the same `-I', `-D' or `-U'
  141.      options that you used in actual compilation.)
  142.  
  143.      A single statement is not enough of an example.  In order to
  144.      compile it, it must be embedded in a complete file of compiler
  145.      input; and the bug might depend on the details of how this is done.
  146.  
  147.      Without a real example one can compile, all anyone can do about
  148.      your bug report is wish you luck.  It would be futile to try to
  149.      guess how to provoke the bug.  For example, bugs in register
  150.      allocation and reloading frequently depend on every little detail
  151.      of the function they happen in.
  152.  
  153.      The problem may depend on what is in the header files on your system;
  154.      it is unreliable for the GNU CC maintainers to try the problem with the
  155.      header files available to them.  By sending CPP output, you can
  156.      eliminate this source of uncertainty and save us a certain
  157.      percentage of wild goose chases.
  158.  
  159.    * The command arguments you gave GNU CC or GNU C++ to compile that
  160.      example and observe the bug.  For example, did you use `-O'?  To
  161.      guarantee you won't omit something important, list all the options.
  162.  
  163.      If we were to try to guess the arguments, we would probably guess
  164.      wrong and then we would not encounter the bug.
  165.  
  166.    * The type of machine you are using, and the operating system name
  167.      and version number.
  168.  
  169.    * A description of what behavior you observe that you believe is
  170.      incorrect.  For example, "The compiler gets a fatal signal," or,
  171.      "The assembler instruction at line 208 in the output is incorrect."
  172.  
  173.      Of course, if the bug is that the compiler gets a fatal signal,
  174.      then one can't miss it.  But if the bug is incorrect output, the
  175.      maintainer might not notice unless it is glaringly wrong.  None of
  176.      us has time to study all the assembler code from a 50-line C
  177.      program just on the chance that one instruction might be wrong.
  178.      We need *you* to do this part!
  179.  
  180.      Even if the problem you experience is a fatal signal, you should
  181.      still say so explicitly.  Suppose something strange is going on,
  182.      such as you have encountered a bug in the C library on your system.
  183.      (This has happened!)  Your copy might crash and the copy here would
  184.      not.  If you said to expect a crash, then when the compiler here fails
  185.      to crash, we would know that the bug was not happening.  If you don't
  186.      say to expect a crash, then we would not know whether the bug was
  187.      happening.  We would not be able to draw any conclusion from our
  188.      observations.
  189.  
  190.      Often the observed symptom is incorrect output when your program
  191.      is run.  Sad to say, this is not enough information unless the
  192.      program is short and simple.  None of us has time to study a large
  193.      program to figure out how it would work if compiled correctly,
  194.      much less which line of it was compiled wrong.  So you will have
  195.      to do that.  Tell us which source line it is, and what incorrect
  196.      result happens when that line is executed.  A person who
  197.      understands the program can find this as easily as finding a bug
  198.      in the program itself.
  199.  
  200.    Here are some things that are not necessary:
  201.  
  202.    * A description of the envelope of the bug.
  203.  
  204.      Often people who encounter a bug spend a lot of time investigating
  205.      which changes to the input file will make the bug go away and which
  206.      changes will not affect it.
  207.  
  208.      This is often time consuming and not very useful, because the way
  209.      we will find the bug is by running a single example under the
  210.      debugger with breakpoints, not by pure deduction from a series of
  211.      examples.  You might as well save your time for something else.
  212.  
  213.      Of course, if you can find a simpler example to report *instead* of
  214.      the original one, that is a convenience.  Errors in the output
  215.      will be easier to spot, running under the debugger will take less
  216.      time, etc.  Most GNU CC bugs involve just one function, so the
  217.      most straightforward way to simplify an example is to delete all
  218.      the function definitions except the one where the bug occurs.
  219.      Those earlier in the file may be replaced by external declarations
  220.      if the crucial function depends on them.  (Exception: inline
  221.      functions may affect compilation of functions defined later in the
  222.      file.)
  223.  
  224.      However, simplification is not vital; if you don't want to do this,
  225.      report the bug anyway and send the entire test case you used.
  226.  
  227.    * In particular, some people insert conditionals `#ifdef BUG' around
  228.      a statement which, if removed, makes the bug not happen.  These
  229.      are just clutter; we won't pay any attention to them anyway.
  230.      Besides, you should send us cpp output, and that can't have
  231.      conditionals.
  232.