From patchwork Wed Feb 27 09:56:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 223575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BC6922C0084 for ; Wed, 27 Feb 2013 20:56:48 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1362563809; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=s9oEYgl6+I66BrASWE1GiZE2dtk=; b=a9m8Y0EZFJz7UO+ UUNfJz12X/tUNQavCUct/BZcYtMTOhf2xpLVEQ0RsJkfBjIsOoCcRTxrotyfJ8sN YGLq5S/0cx8hLvzz2Q4N6ZCAJYwPpt9AT/y18gmj9URx+E1Bc5PMd8JyongVcnT1 5sd+kGGx5Qy+k0wucu9RRj+PyL/U= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:Content-Transfer-Encoding:In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=j65uOSPhaJSkSuCXNNVJQe3EbzKME+djVe8Uf3cg65XFxMf1yMGUADg4kFcWAA z1CMsQrtVA6OO8d95CANV+OfZSWa6qiMgiVxqMFyJKCcih1SrHk7VHERjLU9AG+w 5COLEr2k5odF/UvrUEYEhoX+JHWwzXqkYxBdRi+OH7qOk=; 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 10:56:25 +0100 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-Disposition: inline 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. Marek --- 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)