From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4661 invoked by alias); 27 Feb 2013 09:56:43 -0000 Received: (qmail 4647 invoked by uid 22791); 27 Feb 2013 09:56:42 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Feb 2013 09:56:32 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1R9uU0j026005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Feb 2013 04:56:30 -0500 Received: from redhat.com (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1R9uQWa003683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 27 Feb 2013 04:56:29 -0500 Date: Wed, 27 Feb 2013 09:56:00 -0000 From: Marek Polacek To: "Joseph S. Myers" Cc: GCC Patches Subject: Re: [PATCH] Fix PR56344 Message-ID: <20130227095625.GA15445@redhat.com> References: <20130226182733.GG25197@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg01219.txt.bz2 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 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