[PATCH] Handle '\0' in strcmp in RTL expansion (PR tree-optimization/90892).

Martin Liška mliska@suse.cz
Mon Jun 17 09:26:00 GMT 2019


Hi.

The function c_getstr returns string and length of the string.
In inline_expand_builtin_string_cmp, we should consider situations
where a string constant contains a zero character. In that case
we have to shorten len[12].

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-06-17  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/90892
	* builtins.c (inline_expand_builtin_string_cmp): Handle '\0'
	in string constants.

gcc/testsuite/ChangeLog:

2019-06-17  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/90892
	* gcc.dg/pr90892.c: New test.
---
 gcc/builtins.c                 | 14 ++++++++++++++
 gcc/testsuite/gcc.dg/pr90892.c | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr90892.c


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Handle-0-in-strcmp-in-RTL-expansion-PR-tree-optimiza.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190617/8aa0ddad/attachment.bin>


More information about the Gcc-patches mailing list