From: Marek Polacek <polacek@redhat.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR56344
Date: Wed, 27 Feb 2013 09:56:00 -0000 [thread overview]
Message-ID: <20130227095625.GA15445@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1302262315110.339@digraph.polyomino.org.uk>
On Tue, Feb 26, 2013 at 11:17:22PM +0000, Joseph S. Myers wrote:
> On Tue, 26 Feb 2013, Marek Polacek wrote:
>
> > + /* We don't allow passing huge (> 2^30 B) arguments
> > + by value. It would cause an overflow later on. */
> > + if (adjusted_args_size.constant >= (1 << 30))
> > + {
> > + error ("passing too large argument on stack");
> > + continue;
>
> This should be sorry () not error (), as a compiler limitation rather than
> a defect in the user's program. (And is input_location set to something
> useful here so the diagnostic points to the argument in question rather
> than e.g. to the end of the function containing the problem call?)
Okay, changed back to sorry (). I'd think that input_location is fine
here, for e.g.
struct S { unsigned char s[1 << 30]; } s;
extern void foo (struct S);
void
bar (void)
{
foo (s);
}
we get:
pr56344.c: In function âbarâ:
pr56344.c:7:7: sorry, unimplemented: passing too large argument on stack
foo (s);
^
Ok now?
2013-02-27 Marek Polacek <polacek@redhat.com>
PR middle-end/56344
* calls.c (expand_call): Disallow passing huge arguments
by value.
--- gcc/calls.c.mp 2013-02-26 17:04:33.159555349 +0100
+++ gcc/calls.c 2013-02-27 10:44:02.254461200 +0100
@@ -3037,6 +3037,14 @@ expand_call (tree exp, rtx target, int i
{
rtx before_arg = get_last_insn ();
+ /* We don't allow passing huge (> 2^30 B) arguments
+ by value. It would cause an overflow later on. */
+ if (adjusted_args_size.constant >= (1 << 30))
+ {
+ sorry ("passing too large argument on stack");
+ continue;
+ }
+
if (store_one_arg (&args[i], argblock, flags,
adjusted_args_size.var != 0,
reg_parm_stack_space)
Marek
next prev parent reply other threads:[~2013-02-27 9:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-26 18:27 Marek Polacek
2013-02-26 23:17 ` Joseph S. Myers
2013-02-27 9:56 ` Marek Polacek [this message]
2013-02-27 11:33 ` Richard Biener
2013-02-27 17:38 ` Joseph S. Myers
2013-03-01 8:41 ` Richard Biener
2013-03-05 16:06 ` Marek Polacek
2013-03-13 12:57 ` Marek Polacek
2013-12-02 15:01 ` Richard Biener
2013-12-02 16:40 ` Marek Polacek
2013-12-02 19:19 ` Marek Polacek
2013-12-02 20:35 ` 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=20130227095625.GA15445@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.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).