* [PATCH] Avoid another non zero terminated string constant
@ 2018-07-29 8:14 Bernd Edlinger
2018-07-30 6:52 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Bernd Edlinger @ 2018-07-29 8:14 UTC (permalink / raw)
To: gcc-patches, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
Hi!
This fixes another not NUL terminated string literal that is created
in tree-ssa-forwprop.c at simplify_builtin_call.
src_buf is set up to contain a NUL at src_buf[src_len], thus use src_len + 1
as length parameter to build_string_literal. All other uses of
build_string_literal do it right, as far as I can see.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-forwprop.diff --]
[-- Type: text/x-patch; name="patch-forwprop.diff", Size: 699 bytes --]
2018-07-29 Bernd Edlinger <bernd.edlinger@hotmail.de>
* tree-ssa-forwprop.c (simplify_builtin_call): Don't create a not NUL
terminated string literal.
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c (revision 263045)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -1391,7 +1391,7 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p
src_buf, ptr1_align, false))
break;
- new_str_cst = build_string_literal (src_len, src_buf);
+ new_str_cst = build_string_literal (src_len + 1, src_buf);
if (callee1)
{
/* If STMT1 is a mem{,p}cpy call, adjust it and remove
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid another non zero terminated string constant
2018-07-29 8:14 [PATCH] Avoid another non zero terminated string constant Bernd Edlinger
@ 2018-07-30 6:52 ` Richard Biener
2018-09-14 13:08 ` [PATCH] Avoid another non zero terminated string constant (revert) Bernd Edlinger
0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2018-07-30 6:52 UTC (permalink / raw)
To: Bernd Edlinger; +Cc: gcc-patches
On Sun, 29 Jul 2018, Bernd Edlinger wrote:
> Hi!
>
> This fixes another not NUL terminated string literal that is created
> in tree-ssa-forwprop.c at simplify_builtin_call.
>
> src_buf is set up to contain a NUL at src_buf[src_len], thus use src_len + 1
> as length parameter to build_string_literal. All other uses of
> build_string_literal do it right, as far as I can see.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
OK.
Richard.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid another non zero terminated string constant (revert)
2018-07-30 6:52 ` Richard Biener
@ 2018-09-14 13:08 ` Bernd Edlinger
0 siblings, 0 replies; 3+ messages in thread
From: Bernd Edlinger @ 2018-09-14 13:08 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]
On 07/30/18 08:52, Richard Biener wrote:
> On Sun, 29 Jul 2018, Bernd Edlinger wrote:
>
>> Hi!
>>
>> This fixes another not NUL terminated string literal that is created
>> in tree-ssa-forwprop.c at simplify_builtin_call.
>>
>> src_buf is set up to contain a NUL at src_buf[src_len], thus use src_len + 1
>> as length parameter to build_string_literal. All other uses of
>> build_string_literal do it right, as far as I can see.
>>
>>
>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>> Is it OK for trunk?
>
> OK.
>
> Richard.
>
Hi,
when I installed that patch it appeared to me that naturally all string
constants ought to be zero-terminated.
But since we have now the STRING_CST semantic changes installed,
which do equally support both zero and non-zero terminated string constants,
I want to revert this again:
r263068 | edlinger | 2018-07-30 15:26:25 +0200 (Mo, 30. Jul 2018) | 5 Zeilen
Geänderte Pfade:
M /trunk/gcc/ChangeLog
M /trunk/gcc/tree-ssa-forwprop.c
2018-07-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
* tree-ssa-forwprop.c (simplify_builtin_call): Don't create a not NUL
terminated string literal.
So unless there are reasons to keep this zero-terminated string constant,
I am going to revert this patch today evening, after another
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-revert-r263068.diff --]
[-- Type: text/x-patch; name="patch-revert-r263068.diff", Size: 933 bytes --]
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 263068)
+++ gcc/ChangeLog (revision 263067)
@@ -1,8 +1,3 @@
-2018-07-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
-
- * tree-ssa-forwprop.c (simplify_builtin_call): Don't create a not NUL
- terminated string literal.
-
2018-07-30 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/85160
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c (revision 263068)
+++ gcc/tree-ssa-forwprop.c (revision 263067)
@@ -1391,7 +1391,7 @@
src_buf, ptr1_align, false))
break;
- new_str_cst = build_string_literal (src_len + 1, src_buf);
+ new_str_cst = build_string_literal (src_len, src_buf);
if (callee1)
{
/* If STMT1 is a mem{,p}cpy call, adjust it and remove
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-14 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-29 8:14 [PATCH] Avoid another non zero terminated string constant Bernd Edlinger
2018-07-30 6:52 ` Richard Biener
2018-09-14 13:08 ` [PATCH] Avoid another non zero terminated string constant (revert) Bernd Edlinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).