[PATCH] Check the STRING_CSTs in varasm.c

Jeff Law law@redhat.com
Thu Sep 13 22:02:00 GMT 2018


On 8/24/18 2:18 PM, Bernd Edlinger wrote:
> Hi!
> 
> 
> This is an alternative approach in making STRING_CST semantics
> consistent.
> 
> This means it makes STRING_CST used for literals and for initializers
> use exactly the same semantics.
> 
> It makes sure that all STRING_CST have a TYPE_SIZE_UNIT, and that it is
> always larger than TREE_STRING_LENGTH, these and certain other properties
> are checked in varasm.c, so the currently observed consistency issues
> in the middle-end can be resolved.
> 
> 
> It depends on the following pre-condition patches:
> 
> [PATCH] Use complete_array_type on flexible array member initializers
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01538.html
> 
> PATCHv2] Call braced_list_to_string after array size is fixed
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01565.html
> 
> [PATCHv2] Handle overlength strings in the C FE
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01566.html
> 
> [PATCHv2] Handle overlength strings in C++ FE
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01567.html
> 
> [PATCHv2] Handle overlength string literals in the fortan FE
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01568.html
> 
> The Ada and GO patches are no longer necessary.
> 
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
> 
> 
> Thanks
> Bernd.
> 
> 
> patch-varasm-v2.diff
> 
> 2018-08-24  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> 
> 	* varasm.c (compare_constant): Compare type size of STRING_CSTs.
> 	(get_constant_size): Don't make STRING_CSTs larger than they are.
> 	(check_string_literal): New check function for STRING_CSTs.
> 	(output_constant): Use it.
The prereqs above are all installed and I've installed this patch.
We've still got the pr87053 regression, but I'll commit a fix for that
momentarily.

Jeff



More information about the Gcc-patches mailing list