diff options
Diffstat (limited to 'llvm/docs/HowToSubmitABug.rst')
| -rw-r--r-- | llvm/docs/HowToSubmitABug.rst | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/llvm/docs/HowToSubmitABug.rst b/llvm/docs/HowToSubmitABug.rst index 002087c..d62391b 100644 --- a/llvm/docs/HowToSubmitABug.rst +++ b/llvm/docs/HowToSubmitABug.rst @@ -6,26 +6,26 @@ Introduction - Got bugs? ======================== -If you're working with LLVM and run into a bug, we definitely want to know +If you're working with LLVM and encounter a bug, we definitely want to know about it. This document describes what you can do to increase the odds of getting it fixed quickly. 🔒 If you believe that the bug is security related, please follow :ref:`report-security-issue`. 🔒 -Basically you have to do two things at a minimum. First, decide whether the +Basically, you have to do two things at a minimum. First, decide whether the bug `crashes the compiler`_ or if the compiler is `miscompiling`_ the program (i.e., the compiler successfully produces an executable, but it doesn't run right). Based on what type of bug it is, follow the instructions in the linked section to narrow down the bug so that the person who fixes it will be able to find the problem more easily. -Once you have a reduced test-case, go to `the LLVM Bug Tracking System +Once you have a reduced test case, go to `the LLVM Bug Tracking System <https://github.com/llvm/llvm-project/issues>`_ and fill out the form with the necessary details (note that you don't need to pick a label, just use if you're not sure). The bug description should contain the following information: * All information necessary to reproduce the problem. -* The reduced test-case that triggers the bug. +* The reduced test case that triggers the bug. * The location where you obtained LLVM (if not from our Git repository). @@ -39,10 +39,10 @@ Crashing Bugs More often than not, bugs in the compiler cause it to crash---often due to an assertion failure of some sort. The most important piece of the puzzle is to figure out if it is crashing in the Clang front-end or if it is one of -the LLVM libraries (e.g. the optimizer or code generator) that has +the LLVM libraries (e.g., the optimizer or code generator) that has problems. -To figure out which component is crashing (the front-end, middle-end +To identify the crashing component (the front-end, middle-end optimizer, or backend code generator), run the ``clang`` command line as you were when the crash occurred, but with the following extra command line options: @@ -53,7 +53,7 @@ options: <frontend-crash>`. * ``-emit-llvm``: If ``clang`` crashes with this option (which disables - the code generator), you found a middle-end optimizer bug. Jump ahead to + the code generator), you've found a middle-end optimizer bug. Jump ahead to :ref:`middle-end bugs <middleend-crash>`. * Otherwise, you have a backend code generator crash. Jump ahead to :ref:`code @@ -102,19 +102,19 @@ functions. Then run: If this doesn't crash, please follow the instructions for a :ref:`front-end bug <frontend-crash>`. -If this does crash, then you should be able to debug this with the following +If this does crash, then you can debug this with the following :doc:`bugpoint <Bugpoint>` command: .. code-block:: bash bugpoint foo.bc -O3 -Run this, then file a bug with the instructions and reduced .bc +Run this, then file a bug with the instructions and reduced ``.bc`` files that bugpoint emits. If bugpoint doesn't reproduce the crash, :doc:`llvm-reduce <CommandGuide/llvm-reduce>` is an alternative way to reduce -LLVM IR. Create a script that repros the crash and run: +LLVM IR. Create a script that reproduces the crash and run: .. code-block:: bash @@ -137,16 +137,16 @@ Backend code generator bugs --------------------------- If you find a bug that crashes clang in the code generator, compile your -source file to a .bc file by passing "``-emit-llvm -c -o foo.bc``" to -clang (in addition to the options you already pass). Once your have -foo.bc, one of the following commands should fail: +source file to a ``.bc`` file by passing "``-emit-llvm -c -o foo.bc``" to +clang (in addition to the options you already pass). Once you have +``foo.bc``, one of the following commands should fail: #. ``llc foo.bc`` #. ``llc foo.bc -relocation-model=pic`` #. ``llc foo.bc -relocation-model=static`` If none of these crash, please follow the instructions for a :ref:`front-end -bug<frontend-crash>`. If one of these do crash, you should be able to reduce +bug<frontend-crash>`. If one of these crashes, you should be able to reduce this with one of the following :doc:`bugpoint <Bugpoint>` command lines (use the one corresponding to the command above that failed): @@ -154,9 +154,9 @@ the one corresponding to the command above that failed): #. ``bugpoint -run-llc foo.bc --tool-args -relocation-model=pic`` #. ``bugpoint -run-llc foo.bc --tool-args -relocation-model=static`` -Please run this, then file a bug with the instructions and reduced .bc file +Please run this, then file a bug with the instructions and reduced ``.bc`` file that bugpoint emits. If something goes wrong with bugpoint, please submit -the "foo.bc" file and the option that llc crashes with. +the ``foo.bc`` file and the option that llc crashes with. LTO bugs --------------------------- @@ -174,7 +174,7 @@ in addition to your existing compilation options: These options enable LTO and save temporary files generated during compilation for later analysis. -On Windows, you should be using lld-link as the linker. Adjust your compilation +On Windows, use lld-link as the linker. Adjust your compilation flags as follows: * Add ``/lldsavetemps`` to the linker flags. * When linking from the compiler driver, add ``/link /lldsavetemps`` in order to forward that flag to the linker. @@ -199,7 +199,7 @@ command line (use the bc file corresponding to the command above that failed): llvm-reduce --test reduce.sh a.out.0.2.internalize.bc -Example of reduce.sh script +Example of ``reduce.sh`` script .. code-block:: bash @@ -209,9 +209,9 @@ Example of reduce.sh script path/to/not --crash path/to/opt "-passes=lto<O3>" $1 -o temp.bc 2> err.log grep -q "It->second == &Insn" err.log -Here we have grepped the failed assert message. +Here we have grepped for the failed assert message. -Please run this, then file a bug with the instructions and reduced .bc file +Please run this, then file a bug with the instructions and reduced ``.bc`` file that llvm-reduce emits. .. _miscompiling: @@ -221,16 +221,16 @@ Miscompilations If clang successfully produces an executable, but that executable doesn't run right, this is either a bug in the code or a bug in the compiler. The first -thing to check is to make sure it is not using undefined behavior (e.g. +thing to check is to make sure it is not using undefined behavior (e.g., reading a variable before it is defined). In particular, check to see if the program is clean under various `sanitizers -<https://github.com/google/sanitizers>`_ (e.g. ``clang +<https://github.com/google/sanitizers>`_ (e.g., ``clang -fsanitize=undefined,address``) and `valgrind <http://valgrind.org/>`_. Many "LLVM bugs" that we have chased down ended up being bugs in the program being compiled, not LLVM. Once you determine that the program itself is not buggy, you should choose -which code generator you wish to compile the program with (e.g. LLC or the JIT) +which code generator you wish to compile the program with (e.g., LLC or the JIT) and optionally a series of LLVM passes to run. For example: .. code-block:: bash |
