Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-24 Thread Bernd Edlinger
On 08/24/18 12:52, Richard Biener wrote: > On Wed, Aug 22, 2018 at 6:57 AM Bernd Edlinger > wrote: >> >> On 08/21/18 10:33, Richard Biener wrote: >>> On Mon, 20 Aug 2018, Bernd Edlinger wrote: >>> On 08/20/18 15:19, Richard Biener wrote: > On Mon, 20 Aug 2018, Bernd Edlinger wrote: >

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-21 Thread Bernd Edlinger
On 08/21/18 10:33, Richard Biener wrote: > On Mon, 20 Aug 2018, Bernd Edlinger wrote: > >> On 08/20/18 15:19, Richard Biener wrote: >>> On Mon, 20 Aug 2018, Bernd Edlinger wrote: >>> On 08/20/18 13:01, Richard Biener wrote: > On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger > wrote: >>

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-21 Thread Richard Biener
On Mon, 20 Aug 2018, Bernd Edlinger wrote: > On 08/20/18 15:19, Richard Biener wrote: > > On Mon, 20 Aug 2018, Bernd Edlinger wrote: > > > >> On 08/20/18 13:01, Richard Biener wrote: > >>> On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger > >>> wrote: > > > > On 08/01/18 11:29,

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-20 Thread Bernd Edlinger
On 08/20/18 17:59, Bernd Edlinger wrote: > On 08/20/18 15:19, Richard Biener wrote: >> On Mon, 20 Aug 2018, Bernd Edlinger wrote: >> >>> On 08/20/18 13:01, Richard Biener wrote: On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger wrote: > > > > On 08/01/18 11:29, Richard Biene

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-20 Thread Bernd Edlinger
On 08/20/18 15:19, Richard Biener wrote: > On Mon, 20 Aug 2018, Bernd Edlinger wrote: > >> On 08/20/18 13:01, Richard Biener wrote: >>> On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger >>> wrote: On 08/01/18 11:29, Richard Biener wrote: > > Hmm. I think it would be nice

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-20 Thread Richard Biener
On Mon, 20 Aug 2018, Bernd Edlinger wrote: > On 08/20/18 13:01, Richard Biener wrote: > > On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger > > wrote: > >> > >> > >> > >> On 08/01/18 11:29, Richard Biener wrote: > >>> > >>> Hmm. I think it would be nice if TREE_STRING_LENGTH would > >>> match char[

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-20 Thread Bernd Edlinger
On 08/20/18 13:01, Richard Biener wrote: > On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger > wrote: >> >> >> >> On 08/01/18 11:29, Richard Biener wrote: >>> >>> Hmm. I think it would be nice if TREE_STRING_LENGTH would >>> match char[2] and TYPE_SIZE_UNIT even if that is inconvenient >>> for your

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-20 Thread Richard Biener
On Wed, Aug 1, 2018 at 3:05 PM Bernd Edlinger wrote: > > > > On 08/01/18 11:29, Richard Biener wrote: > > > > Hmm. I think it would be nice if TREE_STRING_LENGTH would > > match char[2] and TYPE_SIZE_UNIT even if that is inconvenient > > for your check above. Because the '\0' doesn't belong to t

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Bernd Edlinger
On 08/01/18 11:29, Richard Biener wrote: > > Hmm. I think it would be nice if TREE_STRING_LENGTH would > match char[2] and TYPE_SIZE_UNIT even if that is inconvenient > for your check above. Because the '\0' doesn't belong to the > string. Then build_string internally appends a '\0' outside >

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Richard Biener
On Wed, 1 Aug 2018, Bernd Edlinger wrote: > >> > The change to have all STRING_CSTs NUL terminated (but that NUL > >> > termination not necessarily inclided in STRING_LENGTH) is a good > >> > one. > >> > > >> > I'm not sure how we can reliably verify NUL termination after the > >> > fact though an

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Bernd Edlinger
>> > The change to have all STRING_CSTs NUL terminated (but that NUL >> > termination not necessarily inclided in STRING_LENGTH) is a good >> > one. >> > >> > I'm not sure how we can reliably verify NUL termination after the >> > fact though and build_string already makes sure to NUL terminate >> >

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Richard Biener
On Wed, 1 Aug 2018, Bernd Edlinger wrote: > > The change to have all STRING_CSTs NUL terminated (but that NUL > > termination not necessarily inclided in STRING_LENGTH) is a good > > one. > > > > I'm not sure how we can reliably verify NUL termination after the > > fact though and build_string al

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Bernd Edlinger
> The change to have all STRING_CSTs NUL terminated (but that NUL > termination not necessarily inclided in STRING_LENGTH) is a good > one. > > I'm not sure how we can reliably verify NUL termination after the > fact though and build_string already makes sure to NUL terminate > STRING_CSTs. So if

Re: [PATCH] Make GO string literals properly NUL terminated

2018-08-01 Thread Richard Biener
On Tue, 31 Jul 2018, Ian Lance Taylor wrote: > On Tue, Jul 31, 2018 at 9:19 AM, Bernd Edlinger > wrote: > > On 07/31/18 16:40, Ian Lance Taylor wrote: > >> On Tue, Jul 31, 2018 at 5:14 AM, Bernd Edlinger > >> wrote: > >>> > >>> could someone please review this patch and check it in into the GO F

Re: [PATCH] Make GO string literals properly NUL terminated

2018-07-31 Thread Ian Lance Taylor
On Tue, Jul 31, 2018 at 9:19 AM, Bernd Edlinger wrote: > On 07/31/18 16:40, Ian Lance Taylor wrote: >> On Tue, Jul 31, 2018 at 5:14 AM, Bernd Edlinger >> wrote: >>> >>> could someone please review this patch and check it in into the GO FE? >> >> I don't understand why the change is correct, and y

Re: [PATCH] Make GO string literals properly NUL terminated

2018-07-31 Thread Bernd Edlinger
On 07/31/18 16:40, Ian Lance Taylor wrote: > On Tue, Jul 31, 2018 at 5:14 AM, Bernd Edlinger > wrote: >> >> could someone please review this patch and check it in into the GO FE? > > I don't understand why the change is correct, and you didn't explain > it. Go strings are not NUL terminated. Go

Re: [PATCH] Make GO string literals properly NUL terminated

2018-07-31 Thread Ian Lance Taylor
On Tue, Jul 31, 2018 at 5:14 AM, Bernd Edlinger wrote: > > could someone please review this patch and check it in into the GO FE? I don't understand why the change is correct, and you didn't explain it. Go strings are not NUL terminated. Go strings always have an associated length. Ian

[PATCH] Make GO string literals properly NUL terminated

2018-07-31 Thread Bernd Edlinger
Hi, could someone please review this patch and check it in into the GO FE? Thanks Bernd. 2018-07-31 Bernd Edlinger * 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-