public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
	       Marek Polacek <polacek@redhat.com>,
	Jason Merrill <jason@redhat.com>,
	       Nathan Sidwell <nathan@acm.org>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Reject too large string literals (PR middle-end/87854)
Date: Fri, 16 Nov 2018 18:31:00 -0000	[thread overview]
Message-ID: <20181116183103.GJ11625@tucnak> (raw)
In-Reply-To: <e0c70714-4555-058c-661c-0453879f4984@gmail.com>

On Fri, Nov 16, 2018 at 11:25:15AM -0700, Martin Sebor wrote:
> On 11/16/2018 01:43 AM, Jakub Jelinek wrote:
> > 
> > +  /* This matters only for targets where ssizetype has smaller precision
> > +     than 32 bits.  */
> > +  if (wi::lts_p (wi::to_wide (TYPE_MAX_VALUE (ssizetype)), length))
> > +    {
> > +      error ("size of string literal is too large");
> 
> It would be helpful to mention the size of the literal and the limit
> so users who do run into the error don't wonder how to fix it.

It is consistent with what we emit for the arrays.
So, if the size and limit info is helpful to users, we should provide that
for those too.  I mean the:
                        if (name)
                          error_at (loc, "size of array %qE is too large",
                        else
                          error_at (loc, "size of unnamed array is too large");
                                    name);
calls in the C FE and similar stuff in C++ FE.
Feel free to add that to all of those.

	Jakub

      reply	other threads:[~2018-11-16 18:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16  8:43 Jakub Jelinek
2018-11-16 12:06 ` Nathan Sidwell
2018-11-16 14:33   ` Marek Polacek
2018-11-16 17:35 ` Joseph Myers
2018-11-16 18:25 ` Martin Sebor
2018-11-16 18:31   ` Jakub Jelinek [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=20181116183103.GJ11625@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=msebor@gmail.com \
    --cc=nathan@acm.org \
    --cc=polacek@redhat.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).