Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

143 lines
6.1KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Bug Criteria (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="Bug Criteria (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="Bug Criteria (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Bugs.html#Bugs" rel="up" title="Bugs">
  30. <link href="Bug-Reporting.html#Bug-Reporting" rel="next" title="Bug Reporting">
  31. <link href="Bugs.html#Bugs" rel="prev" title="Bugs">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Bug-Criteria"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Bug-Reporting.html#Bug-Reporting" accesskey="n" rel="next">Bug Reporting</a>, Up: <a href="Bugs.html#Bugs" accesskey="u" rel="up">Bugs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Have-You-Found-a-Bug_003f"></a>
  68. <h3 class="section">15.1 Have You Found a Bug?</h3>
  69. <a name="index-bug-criteria"></a>
  70. <p>If you are not sure whether you have found a bug, here are some guidelines:
  71. </p>
  72. <ul>
  73. <li> <a name="index-fatal-signal"></a>
  74. <a name="index-core-dump"></a>
  75. If the compiler gets a fatal signal, for any input whatever, that is a
  76. compiler bug. Reliable compilers never crash.
  77. </li><li> <a name="index-invalid-assembly-code"></a>
  78. <a name="index-assembly-code_002c-invalid"></a>
  79. If the compiler produces invalid assembly code, for any input whatever
  80. (except an <code>asm</code> statement), that is a compiler bug, unless the
  81. compiler reports errors (not just warnings) which would ordinarily
  82. prevent the assembler from being run.
  83. </li><li> <a name="index-undefined-behavior"></a>
  84. <a name="index-undefined-function-value"></a>
  85. <a name="index-increment-operators"></a>
  86. If the compiler produces valid assembly code that does not correctly
  87. execute the input source code, that is a compiler bug.
  88. <p>However, you must double-check to make sure, because you may have a
  89. program whose behavior is undefined, which happened by chance to give
  90. the desired results with another C or C++ compiler.
  91. </p>
  92. <p>For example, in many nonoptimizing compilers, you can write &lsquo;<samp>x;</samp>&rsquo;
  93. at the end of a function instead of &lsquo;<samp>return x;</samp>&rsquo;, with the same
  94. results. But the value of the function is undefined if <code>return</code>
  95. is omitted; it is not a bug when GCC produces different results.
  96. </p>
  97. <p>Problems often result from expressions with two increment operators,
  98. as in <code>f (*p++, *p++)</code>. Your previous compiler might have
  99. interpreted that expression the way you intended; GCC might
  100. interpret it another way. Neither compiler is wrong. The bug is
  101. in your code.
  102. </p>
  103. <p>After you have localized the error to a single source line, it should
  104. be easy to check for these things. If your program is correct and
  105. well defined, you have found a compiler bug.
  106. </p>
  107. </li><li> If the compiler produces an error message for valid input, that is a
  108. compiler bug.
  109. </li><li> <a name="index-invalid-input"></a>
  110. If the compiler does not produce an error message for invalid input,
  111. that is a compiler bug. However, you should note that your idea of
  112. &ldquo;invalid input&rdquo; might be someone else&rsquo;s idea of &ldquo;an extension&rdquo; or
  113. &ldquo;support for traditional practice&rdquo;.
  114. </li><li> If you are an experienced user of one of the languages GCC supports, your
  115. suggestions for improvement of GCC are welcome in any case.
  116. </li></ul>
  117. <hr>
  118. <div class="header">
  119. <p>
  120. Next: <a href="Bug-Reporting.html#Bug-Reporting" accesskey="n" rel="next">Bug Reporting</a>, Up: <a href="Bugs.html#Bugs" accesskey="u" rel="up">Bugs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  121. </div>
  122. </body>
  123. </html>