public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Jeff Law <law@redhat.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>,
	Richard Biener <rguenther@suse.de>,
	Joseph Myers	<joseph@codesourcery.com>,
	Nathan Sidwell <nathan@acm.org>, Jason Merrill	<jason@redhat.com>
Subject: Re: [PATCH] Use complete_array_type on flexible array member initializers
Date: Fri, 07 Sep 2018 17:44:00 -0000	[thread overview]
Message-ID: <VI1PR0701MB286267410E77C0C3E9786475E4000@VI1PR0701MB2862.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <VI1PR0701MB2862282C24B5541CEDED772AE4000@VI1PR0701MB2862.eurprd07.prod.outlook.com>

On 09/07/18 15:36, Bernd Edlinger wrote:
> On 09/07/18 08:51, Bernd Edlinger wrote:
>> On 09/07/18 00:26, Jeff Law wrote:
>>> On 09/06/2018 04:16 PM, Jeff Law wrote:
>>>> On 09/06/2018 04:01 PM, Jeff Law wrote:
>>>>> On 09/06/2018 11:12 AM, Bernd Edlinger wrote:
>>>>>
>>>>>>>
>>>>>>
>>>>>> Ah, thanks a lot.
>>>>>>
>>>>>> Okay, this is the status of the STRING-CST semantic-v2 patches:
>>>>>>
>>>>>> [PATCH] Check the STRING_CSTs in varasm.c
>>>>>> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01569.html
>>>>>> => Unfortunately I forgot to change the Title to [PATCHv2] or so.
>>>>>> Should I send a ping for this one?
>>>>>>
>>>>>> [PATCHv2] Handle overlength strings in the C FE
>>>>>> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01566.html
>>>>>> => Should I send a ping for this one?
>>>>> No need to ping.  I've got it here.  What's odd is that it's regressing
>>>>> 87053 .
>>>> Which is probably a sign that we've got an incorrect test for NUL
>>>> termination somewhere.
>>
>> It may be a sign that we should first fix the low level functions
>> before the high level stuff.
>>
>>> I think I've found the issue.  I've got more testing to do, but looks
>>> like a thinko on my part.
>>>
>>
>> Ah, I forgot, the regression on pr87053 and fortran.dg/pr45636.f90
>> is fixed by this patch:
>>
>> [PATCH] Adjust c_getstr/c_strlen to new STRING_CST semantic
>> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg02013.html
>>
>> This is a new regression since the patch was initially posted.
>>
> 
> Well, actually both patches seem to have a circular dependency.
> 
> If you want we can break this dependency by adding this to the  c_getstr patch:
> 
> --- gcc/fold-const.c    2018-09-07 14:22:50.047964775 +0200
> +++ gcc/fold-const.c    2018-09-07 15:06:46.656989904 +0200
> @@ -14611,6 +14611,10 @@ c_getstr (tree src, unsigned HOST_WIDE_I
>     unsigned HOST_WIDE_INT string_length = TREE_STRING_LENGTH (src);
>     unsigned HOST_WIDE_INT string_size = tree_to_uhwi (mem_size);
> 
> +  /* Ideally this would turn into a gcc_checking_assert over time.  */
> +  if (string_length > string_size)
> +    return NULL;
> +
>     const char *string = TREE_STRING_POINTER (src);
> 
>     if (string_length == 0
> 
> 
> This should allow it to work with current semantics as well.
> 

Oops, this does not work for strlenopt-49.c...

Please make it:

--- gcc/fold-const.c	2018-09-07 19:39:19.555588785 +0200
+++ gcc/fold-const.c	2018-09-07 19:30:03.372583484 +0200
@@ -14611,6 +14611,10 @@ c_getstr (tree src, unsigned HOST_WIDE_I
    unsigned HOST_WIDE_INT string_length = TREE_STRING_LENGTH (src);
    unsigned HOST_WIDE_INT string_size = tree_to_uhwi (mem_size);
  
+  /* Ideally this would turn into a gcc_checking_assert over time.  */
+  if (string_length > string_size)
+    string_length = string_size;
+
    const char *string = TREE_STRING_POINTER (src);
  
    if (string_length == 0



Bernd.

      reply	other threads:[~2018-09-07 17:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 13:13 Bernd Edlinger
2018-08-26  5:36 ` Jeff Law
2018-08-26  8:52   ` Bernd Edlinger
2018-08-29 21:11     ` Jason Merrill
2018-09-03  3:44     ` Jeff Law
2018-09-03 12:35       ` Bernd Edlinger
2018-09-04 14:31         ` Jeff Law
2018-09-06 11:05           ` Bernd Edlinger
2018-09-06 15:44             ` Jeff Law
2018-09-06 17:12               ` Bernd Edlinger
2018-09-06 22:01                 ` Jeff Law
2018-09-06 22:16                   ` Jeff Law
2018-09-06 22:26                     ` Jeff Law
2018-09-07  6:51                       ` Bernd Edlinger
2018-09-07 13:36                         ` Bernd Edlinger
2018-09-07 17:44                           ` Bernd Edlinger [this message]

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=VI1PR0701MB286267410E77C0C3E9786475E4000@VI1PR0701MB2862.eurprd07.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=law@redhat.com \
    --cc=nathan@acm.org \
    --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).