home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !gcc / docs / bugs < prev    next >
Encoding:
Text File  |  2004-08-07  |  11.3 KB  |  248 lines

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