public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Ian Lance Taylor	<ian@airs.com>,
	Richard Biener <rguenther@suse.de>
Subject: [PATCH] Make GO string literals properly NUL terminated
Date: Tue, 31 Jul 2018 12:14:00 -0000	[thread overview]
Message-ID: <AM5PR0701MB26570687DEEC36D3BE2F21F4E42E0@AM5PR0701MB2657.eurprd07.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

Hi,


could someone please review this patch and check it in into the GO FE?


Thanks
Bernd.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-go-strings.diff --]
[-- Type: text/x-patch; name="patch-go-strings.diff", Size: 748 bytes --]

2018-07-31  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* go-gcc.cc (Gcc_backend::string_constant_expression): Make string
	literal properly NUL terminated.

diff -pur gcc/go/go-gcc.cc gcc/go/go-gcc.cc
--- gcc/go/go-gcc.cc	2018-06-28 19:46:36.000000000 +0200
+++ gcc/go/go-gcc.cc	2018-07-31 12:52:24.690236476 +0200
@@ -1394,7 +1394,7 @@ Gcc_backend::string_constant_expression(
 					      TYPE_QUAL_CONST);
   tree string_type = build_array_type(const_char_type, index_type);
   TYPE_STRING_FLAG(string_type) = 1;
-  tree string_val = build_string(val.length(), val.data());
+  tree string_val = build_string(val.length() + 1, val.data());
   TREE_TYPE(string_val) = string_type;
 
   return this->make_expression(string_val);

             reply	other threads:[~2018-07-31 12:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 12:14 Bernd Edlinger [this message]
2018-07-31 14:40 ` Ian Lance Taylor
2018-07-31 16:19   ` Bernd Edlinger
2018-07-31 20:18     ` Ian Lance Taylor
2018-08-01  7:01       ` Richard Biener
2018-08-01  7:44         ` Bernd Edlinger
2018-08-01  7:53           ` Richard Biener
2018-08-01  9:22             ` Bernd Edlinger
2018-08-01  9:30               ` Richard Biener
2018-08-01 13:05                 ` Bernd Edlinger
2018-08-20 11:02                   ` Richard Biener
2018-08-20 12:10                     ` Bernd Edlinger
2018-08-20 13:19                       ` Richard Biener
2018-08-20 15:59                         ` Bernd Edlinger
2018-08-21  5:30                           ` Bernd Edlinger
2018-08-21  8:33                           ` Richard Biener
2018-08-22  4:57                             ` Bernd Edlinger
2018-08-24 10:52                               ` Richard Biener
2018-08-24 11:49                                 ` Bernd Edlinger
2018-08-24 12:57                                   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM5PR0701MB26570687DEEC36D3BE2F21F4E42E0@AM5PR0701MB2657.eurprd07.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ian@airs.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).