diff options
author | Iskander Shakirzyanov <iskander@ispras.ru> | 2022-11-24 14:26:59 +0000 |
---|---|---|
committer | Alexander Monakov <amonakov@ispras.ru> | 2022-11-30 16:30:48 +0300 |
commit | 7c01d029fca669263b9c2dcb8837c42f7ae3a77f (patch) | |
tree | 7990b3eae36ff8a67c01bc63050152b59ae671e3 /libgcc/soft-fp/unorddf2.c | |
parent | 4fa25a7eb322f0a003c1eb15680c71ece345e01e (diff) | |
download | gcc-7c01d029fca669263b9c2dcb8837c42f7ae3a77f.zip gcc-7c01d029fca669263b9c2dcb8837c42f7ae3a77f.tar.gz gcc-7c01d029fca669263b9c2dcb8837c42f7ae3a77f.tar.bz2 |
Make Warray-bounds alias to Warray-bounds= [PR107787]
According to the documentation, the -Werror= option makes the specified
warning into an error and also automatically implies that option. Then
it seems that the behavior of the compiler when specifying
-Werror=array-bounds=X should be the same as specifying
"-Werror=array-bounds -Warray-bounds=X", so we expect to receive
array-bounds pass diagnostics and they must be processed as errors.
In practice, we observe that the array-bounds pass is indeed invoked,
but its diagnostics are processed as warnings, not errors.
This happens because Warray-bounds and Warray-bounds= are
declared as two different options in common.opt, so when
diagnostic_classify_diagnostic is called, DK_ERROR is set for
the Warray-bounds= option, but diagnostic_report_diagnostic called from
warning_at receives opt_index of Warray-bounds, so information about
DK_ERROR is lost. Fix this by using Alias in declaration of
Warray-bounds (similar to Wattribute-alias).
Co-authored-by: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
gcc/ChangeLog:
PR driver/107787
* common.opt (Warray-bounds): Turn into alias of
-Warray-bounds=1.
* builtins.cc (c_strlen): Use OPT_Warray_bounds_
instead of OPT_Warray_bounds.
* diagnostic-spec.cc (nowarn_spec_t::nowarn_spec_t): Ditto.
* gimple-array-bounds.cc (array_bounds_checker::check_array_ref,
array_bounds_checker::check_mem_ref,
array_bounds_checker::check_addr_expr,
array_bounds_checker::check_array_bounds): Ditto.
* gimple-ssa-warn-restrict.cc (maybe_diag_access_bounds): Ditto.
gcc/c-family/ChangeLog:
PR driver/107787
* c-common.cc (fold_offsetof,
convert_vector_to_array_for_subscript): Use OPT_Warray_bounds_
instead of OPT_Warray_bounds.
gcc/testsuite/ChangeLog:
PR driver/107787
* gcc.dg/Warray-bounds-34.c: Correct the regular expression
for -Warray-bounds=.
* gcc.dg/Warray-bounds-43.c: Likewise.
* gcc.dg/pr107787.c: New test.
Diffstat (limited to 'libgcc/soft-fp/unorddf2.c')
0 files changed, 0 insertions, 0 deletions