Lewis Hyatt f3b957ea8b pch: Fix streaming of strings with embedded null bytes
When a GTY'ed struct is streamed to PCH, any plain char* pointers it contains
(whether they live in GC-controlled memory or not) will be marked for PCH
output by the routine gt_pch_note_object in ggc-common.cc. This routine
special-cases plain char* strings, and in particular it uses strlen() to get
their length. Thus it does not handle strings with embedded null bytes, but it
is possible for something PCH cares about (such as a string literal token in a
macro definition) to contain such embedded nulls. To fix that up, add a new
GTY option "string_length" so that gt_pch_note_object can be informed the
actual length it ought to use, and use it in the relevant libcpp structs
(cpp_string and ht_identifier) accordingly.

gcc/ChangeLog:

	* gengtype.cc (output_escaped_param): Add missing const.
	(get_string_option): Add missing check for option type.
	(walk_type): Support new "string_length" GTY option.
	(write_types_process_field): Likewise.
	* ggc-common.cc (gt_pch_note_object): Add optional length argument.
	* ggc.h (gt_pch_note_object): Adjust prototype for new argument.
	(gt_pch_n_S2): Declare...
	* stringpool.cc (gt_pch_n_S2): ...new function.
	* doc/gty.texi: Document new GTY((string_length)) option.

libcpp/ChangeLog:

	* include/cpplib.h (struct cpp_string): Use new "string_length" GTY.
	* include/symtab.h (struct ht_identifier): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/pch/pch-string-nulls.C: New test.
	* g++.dg/pch/pch-string-nulls.Hs: New test.
2022-10-19 09:26:09 -04:00
2022-03-19 00:16:22 +00:00
2022-09-01 00:17:39 +00:00
2022-10-08 00:17:29 +00:00
2022-10-08 00:17:29 +00:00
2022-09-01 00:17:39 +00:00
2022-08-31 00:16:45 +00:00
2022-10-14 00:16:35 +00:00
2021-11-30 00:16:44 +00:00
2022-08-26 00:16:21 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-06-04 00:16:27 +00:00
2022-10-08 00:17:29 +00:00
2022-10-13 00:17:37 +00:00
2022-10-19 00:19:08 +00:00
2022-10-13 00:17:37 +00:00
2022-10-18 00:17:40 +00:00
2022-10-19 00:19:08 +00:00
2022-10-14 00:16:35 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-10-13 00:17:37 +00:00
2022-07-29 00:16:21 +00:00
2022-10-13 00:17:37 +00:00
2022-07-19 17:07:04 +03:00
2022-10-13 00:17:37 +00:00
2021-12-21 09:10:57 +01: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%