Qing Zhao 710c967652 Update -Warray-bounds with -fstrict-flex-arrays.
A. add the following to clarify the relationship between -Warray-bounds
        and the LEVEL of -fstrict-flex-array:

     By default, the trailing array of a structure will be treated as a
     flexible array member by '-Warray-bounds' or '-Warray-bounds=N' if
     it is declared as either a flexible array member per C99 standard
     onwards ('[]'), a GCC zero-length array extension ('[0]'), or an
     one-element array ('[1]').  As a result, out of bounds subscripts
     or offsets into zero-length arrays or one-element arrays are not
     warned by default.

     You can add the option '-fstrict-flex-arrays' or
     '-fstrict-flex-arrays=LEVEL' to control how this option treat
     trailing array of a structure as a flexible array member.

     when LEVEL<=1, no change to the default behavior.

     when LEVEL=2, additional warnings will be issued for out of bounds
     subscripts or offsets into one-element arrays;

     when LEVEL=3, in addition to LEVEL=2, additional warnings will be
     issued for out of bounds subscripts or offsets into zero-length
     arrays.

     B. change -Warray-bounds=2 to exclude its control on how to treat
        trailing arrays as flexible array members:

     '-Warray-bounds=2'
          This warning level also warns about the intermediate results
          of pointer arithmetic that may yield out of bounds values.
          This warning level may give a larger number of false positives
          and is deactivated by default.

gcc/ChangeLog:

	* attribs.cc (strict_flex_array_level_of): New function.
	* attribs.h (strict_flex_array_level_of): Prototype for new function.
	* doc/invoke.texi: Update -Warray-bounds by specifying the impact from
	-fstrict-flex-arrays. Also update -Warray-bounds=2 by eliminating its
	impact on treating trailing arrays as flexible array members.
	* gimple-array-bounds.cc (get_up_bounds_for_array_ref): New function.
	(check_out_of_bounds_and_warn): New function.
	(array_bounds_checker::check_array_ref): Update with call to the above
	new functions.
	* tree.cc (array_ref_flexible_size_p): Add one new argument.
	(component_ref_sam_type): New function.
	(component_ref_size): Control with level of strict-flex-array.
	* tree.h (array_ref_flexible_size_p): Update prototype.
	(enum struct special_array_member): Add two new enum values.
	(component_ref_sam_type): New prototype.

gcc/c/ChangeLog:

	* c-decl.cc (is_flexible_array_member_p): Call new function
	strict_flex_array_level_of.

gcc/testsuite/ChangeLog:

	* gcc.dg/Warray-bounds-11.c: Update warnings for -Warray-bounds=2.
	* gcc.dg/Warray-bounds-flex-arrays-1.c: New test.
	* gcc.dg/Warray-bounds-flex-arrays-2.c: New test.
	* gcc.dg/Warray-bounds-flex-arrays-3.c: New test.
	* gcc.dg/Warray-bounds-flex-arrays-4.c: New test.
	* gcc.dg/Warray-bounds-flex-arrays-5.c: New test.
	* gcc.dg/Warray-bounds-flex-arrays-6.c: New test.
2022-12-06 18:50:04 +00:00
2022-11-24 00:17:47 +00:00
2022-11-15 08:32:29 +00:00
2022-11-24 00:17:47 +00:00
2022-09-01 00:17:39 +00:00
2022-08-31 00:16:45 +00:00
2022-11-16 00:17:09 +00:00
2022-11-24 00:17:47 +00:00
2022-08-26 00:16:21 +00:00
2022-11-17 00:16:52 +00:00
2022-10-13 00:17:37 +00:00
2022-11-02 00:17:38 +00:00
2022-11-24 00:17:47 +00:00
2022-11-24 00:17:47 +00:00
2022-11-24 00:17:47 +00:00
2022-10-13 00:17:37 +00:00
2022-11-30 12:21:15 -08:00
2022-11-24 00:17:47 +00:00
2022-12-05 00:17:24 +00:00
2022-10-13 00:17:37 +00:00
2022-12-05 00:17:24 +00:00
2022-11-24 00:17:47 +00:00
2022-12-01 00:17:51 +00:00
2022-11-24 00:17:47 +00:00
2022-07-19 17:07:04 +03:00
2022-11-26 00:17:08 +00:00
2021-12-21 09:10:57 +01:00
2022-10-31 11:15:45 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%