[PATCH] expr: build string_constant only for a char type

Martin Liška mliska@suse.cz
Mon Jul 27 14:12:09 GMT 2020


On 7/27/20 3:16 PM, Jakub Jelinek wrote:
> On Mon, Jul 27, 2020 at 02:32:15PM +0200, Martin Liška wrote:
>> As mentioned in the PR, we should not create a string constant for a type
>> that is different from char_type_node. Looking at expr.c, I was inspired
>> and used 'TYPE_MAIN_VARIANT (chartype) == char_type_node' to verify that underlying
>> type is a character type.
> 
> That doesn't look correct, there is char, signed char, unsigned char,
> or say std::byte, and all of them are perfectly fine.
> So, rather than requiring it is char and nothing else, you should instead
> check that it is an INTEGRAL_TYPE_P (maybe better other than BOOLEAN_TYPE?),
> which is complete and has the same TYPE_PRECISION as char_type_node.

All right, the following survives tests and bootstraps.

Ready to be installed?
Thanks,
Martin

> 
> 	Jakub
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-expr-build-string_constant-only-for-a-char-type.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200727/ba166a8f/attachment-0001.bin>


More information about the Gcc-patches mailing list