https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119576

            Bug ID: 119576
           Summary: Please remove -Warray-bounds from -Wall
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

See meta-bug #56456 for both "false negative" and "false positive" reports with
-Warray-bounds.
See bug #107677 for a user asking "What is the intended behavior of
-Warray-bounds?" and (IMHO) failing to receive a reasonable answer.

For purposes of this issue here, I don't care about false negatives. I also
don't care about -Wstringop-overflow — also plagued by false positives —
because -Wstringop-overflow is rightly not enabled by `-Wall`. But I very much
do care about the fact that GCC's `-Wall` produces a flood of false positives!

Here are a small sampling of the false positives you get from `-Warray-bounds`
today:

Bugs #81601, #84863, #88771, #92539, #94675, #96900, #104603, #109717, #110283,
#110645, #111750, #115005, #117067, #114826 are false positives in user code.

Bugs #111415, #111374, #113239, #114945, #116841 are false positives inside
libstdc++'s std::vector itself.

Bugs #118253 are false positives inside libstdc++'s std::shared_ptr.

Bugs #104165, #107699, #107986, #117829 are false positives inside libstdc++'s
std::sort.

The "industry default" practice is to use `-Wall`, or often `-Wall -Wextra`, in
their Makefiles. But this produces false positives because `-Wall` currently
enables `-Warray-bounds`.
I believe that the right engineering choice today is simply that GCC users
should use `-Wall -Wextra -Wno-array-bounds`. But it can be difficult to sell a
`-Wno-...` flag to your coworkers. It would be worlds better if the next
release of GCC simply shipped a `-Wall` option that didn't enable the
false-positive-flood of `-Warray-bounds`.

Can we please remove -Warray-bounds from the industry-default set of options
enabled by "-Wall -Wextra"?

Reply via email to