This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC compiler -Warray-bounds option
- From: Jeff Law <law at redhat dot com>
- To: "Mustafa i." <milhan at mail dot csuchico dot edu>, gcc at gcc dot gnu dot org
- Date: Mon, 26 Feb 2018 08:52:43 -0700
- Subject: Re: GCC compiler -Warray-bounds option
- Authentication-results: sourceware.org; auth=none
- References: <CAGRzKbYqfx5Q8=9mMTUB5HCaFM7yBmVfnLfA56sQBcnJ+0Q8Pg@mail.gmail.com> <3fab0879-07ef-c774-283a-5c4eb88dfbb9@redhat.com> <CAGRzKbbO5srsLxTMk_+y9WiMANUUzVbyaizapA+11P9kNNqadg@mail.gmail.com>
On 02/26/2018 02:41 AM, Mustafa i. wrote:
> Hello,
>
> What exactly is the -Warray-bounds option to the GCC compiler supposed
> to warn about?
It's meant to warn for out of bounds array access.
For example, if you have a 10 element array, but try to access the 11th
element you should get a warning.
The warning is only available when the VRP pass is enabled (VRP is
enabled by default at -O2 and above).
Jeff