public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Martin Sebor <msebor@gmail.com>, Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] fold more string comparison with known result (PR 90879)
Date: Tue, 13 Aug 2019 02:22:00 -0000	[thread overview]
Message-ID: <e1c334d2-891b-7a91-5c22-6ebfce701234@redhat.com> (raw)
In-Reply-To: <2d95fa01-9e69-26e5-4634-b9906976d8f4@gmail.com>

On 8/12/19 4:17 PM, Martin Sebor wrote:
> On 8/12/19 2:04 PM, Jeff Law wrote:
>> On 8/9/19 4:14 PM, Martin Sebor wrote:
>>> On 8/9/19 10:58 AM, Jakub Jelinek wrote:
>>>> On Fri, Aug 09, 2019 at 10:51:09AM -0600, Martin Sebor wrote:
>>>>> That said, we should change this code one way or the other.
>>>>> There is even less of a guarantee that other compilers support
>>>>> writing past the end of arrays that have non-zero size than
>>>>> that they recognize the documented zero-length extension.
>>>>
>>>> We use that everywhere forever, so no.
>>>
>>> Just because some invalid code has been in place "forever" doesn't
>>> mean it cannot be changed.  Relying on undocumented "extensions"
>>> because they just happen to work with the compilers they have been
>>> exposed to is exactly how naive users get in trouble.  Our answer
>>> to reports of "bugs" when the behavior changes is typically: fix
>>> your code.  There's little reason to expect other compiler writers
>>> to be any more accommodating.
>>>
>>>> See e.g. rtx u.fld and u.hwint arrays, tree_exp operands array,
>>>> gimple_statement_with_ops op array just to name a few that are
>>>> everywhere.  Coverity is indeed unhappy about
>>>> that, but it would be with [0] certainly too.  Another option is
>>>> to use maximum possible size where we know it (which is the case of
>>>> rtxes and most tree expressions and gimple stmts, but not e.g.
>>>> CALL_EXPR or GIMPLE_CALL where there is no easy upper bound.
>>>
>>> The solution introduced in C99 is a flexible array.  C++
>>> compilers usually support it as well.  Those that don't are
>>> likely to support the zero-length array (even Visual C++ does).
>>> If there's a chance that some don't support either do you really
>>> think it's safe to assume they will do something sane with
>>> the [1] hack?  If you're concerned that the flexible array syntax
>>> or the zero length array won't compile, add a configure test to
>>> see if it does and use whatever alternative is most appropriate.
>> Given that we require a C++03 compiler to build GCC, I think we can
>> revisit how we represent the trailing array.  But that seems independent
>> of the bulk of this patch.
>>
>> Can we separate this issue from the rest of the patch?
> 
> The updated patch I posted is independent of the trailing
> [1] array hack:
> 
>   https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00643.html
I must have dropped this from my queue by accident.  I'll go find it and
give it a looksie as well.

jeff

  reply	other threads:[~2019-08-12 23:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 16:42 Martin Sebor
2019-08-09 16:51 ` Jakub Jelinek
2019-08-09 17:07   ` Martin Sebor
2019-08-09 17:07     ` Jakub Jelinek
2019-08-09 22:45       ` Martin Sebor
2019-08-12 13:56         ` Michael Matz
2019-08-14 16:30           ` Martin Sebor
2019-08-12 20:15         ` Jeff Law
2019-08-12 22:32           ` Martin Sebor
2019-08-13  2:22             ` Jeff Law [this message]
2019-08-13 20:08     ` Jeff Law
2019-08-13 23:26       ` Martin Sebor
2019-08-14  0:39         ` Jeff Law
2019-08-14 20:57           ` Martin Sebor
2019-08-21  7:40             ` Martin Sebor
2019-08-22 22:23               ` Jeff Law
2019-08-28 21:36                 ` Martin Sebor
2019-09-03 20:01                   ` Jeff Law
2019-09-23 22:14                     ` Martin Sebor
2019-10-04 21:15                       ` Jeff Law
2019-08-12 22:22 ` Jeff Law

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=e1c334d2-891b-7a91-5c22-6ebfce701234@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=msebor@gmail.com \
    /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).