Skip to content

Commit 1977894

Browse files
committed
Address some of Dan's comments
1 parent 390d37d commit 1977894

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

clang/docs/BoundsSafetyAdoptionGuide.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Address compiler diagnostics
4646
============================
4747

4848
Once you pass ``-fbounds-safety`` to compiler a C file, you will see some new
49-
compiler warnings and errors, which will lead you to adopt the feature and
50-
to remove unsafeness in the code. Consider the following example:
49+
compiler warnings and errors, which guide adoption of ``-fbounds-safety``.
50+
Consider the following example:
5151

5252
.. code-block:: c
5353
@@ -59,8 +59,9 @@ to remove unsafeness in the code. Consider the following example:
5959
}
6060
6161
The parameter ``int *p`` doesn't have a bounds annotation, so the compiler will
62-
complain about the code indexing into it (``p[i]``). To address the diagnostics,
63-
you should add a bounds annotation on ``int *p`` so that the compiler can reason
62+
complain about the code indexing into it (``p[i]``) as it assumes that ``p`` is
63+
pointing to a single ``int`` object or null. To address the diagnostics, you
64+
should add a bounds annotation on ``int *p`` so that the compiler can reason
6465
about the safety of the array subscript. In the following example, ``p`` is now
6566
``int *__counted_by(n)``, so the compiler will allow the array subscript with
6667
additional run-time checks as necessary.
@@ -74,11 +75,13 @@ additional run-time checks as necessary.
7475
p[i] = 0; // ok; `p` is now has a type with bounds annotation.
7576
}
7677
77-
Run unit tests to fix new run-time traps
78+
Run test suites to fix new run-time traps
7879
========================================
7980

8081
Adopting ``-fbounds-safety`` may cause your program to trap if it violates
81-
bounds safety or it has incorrect adoption.
82+
bounds safety or it has incorrect adoption. Thus, it is necessary to perform
83+
run-time testing of your program to gain confidence that it won't trap at
84+
run time.
8285

8386
Repeat the process for each remaining file
8487
==========================================

0 commit comments

Comments
 (0)