GCC compiler -Warray-bounds option

Jeff Law law@redhat.com
Mon Feb 26 15:52:00 GMT 2018


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



More information about the Gcc mailing list