This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, obvious?] Some minor nits in string folding functions
- From: Martin Sebor <msebor at gmail dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>
- Date: Thu, 19 Jul 2018 13:37:02 -0600
- Subject: Re: [PATCH, obvious?] Some minor nits in string folding functions
- References: <AM5PR0701MB2657279EAD8AE697C7826648E4520@AM5PR0701MB2657.eurprd07.prod.outlook.com>
On 07/19/2018 12:04 PM, Bernd Edlinger wrote:
Hi,
this fixes a few minor nits, which I spotted while
looking at the string folding functions:
Please hold off until the patch for bug 86532 has been reviewed,
approved, and committed. I'm making changes in this area,
partly to address some of your comments on it, including some
of the same ones you are making here. It doesn't help for you
to be making other changes to the same code at the same time.
Thanks
Martin
string_constant: Remove impossible check: TREE_CODE (arg)
can't be COMPONENT_REF and MEM_REF at the same time.
c_strlen: maxelts is (signed) HOST_WIDE_INT, therefore
use tree_to_shwi.
c_getstr: tree_to_uhwi needs to be protected by
tree_fits_uhwi_p.
BTW: c_getstr uses string_constant which appears to be
able to extract wide char string initializers, but c_getstr
does not seem to be prepared for wide char strings:
else if (string[string_length - 1] != '\0')
{
/* Support only properly NUL-terminated strings but handle
consecutive strings within the same array, such as the six
substrings in "1\0002\0003". */
return NULL;
}
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.