From patchwork Fri Oct 19 07:18:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 986581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487870-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rEm/84H7"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42by2P3jMDz9sCW for ; Fri, 19 Oct 2018 18:18:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=hrMdZfynBWjCPECo btUT/MQYZ4F/M1uOdK8ag/kyu502pVQoHNKnDEGsvPkQkgPsNdTDbqfBAFIpqdyM ZNLB4J0C/1V9+iqlZ4vMUqfDRHnJoQhG/TFDc15Ph3g32B8n6JNP5PI8NTKIiOtA yrGnNSVCyh0eqX8ehlwktbLW9sU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=nZjSObuB0pRU++u2+UJqMd /xNlA=; b=rEm/84H7WapOxV8NsjF2NLA3X6vHceGmcOv9qecDN2XqWHOzhxiu6t 2Peki+x7OyyHfSKzQ+3xnEFyJ+NNM0k+Ts8624CK+7lVG7aDL9DJ/dHkibmMHVpg lYu9BbnmlzGLxpEMiCSO3wOMz3tjJxjSL1YNJQhoSFSFOcd3aWft8= Received: (qmail 107002 invoked by alias); 19 Oct 2018 07:18:44 -0000 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 Received: (qmail 106985 invoked by uid 89); 19 Oct 2018 07:18:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=userfriendly, user-friendly, layout_decl X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Oct 2018 07:18:42 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id A0AC2814FA for ; Fri, 19 Oct 2018 09:18:38 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Iw5jEIxtHGV for ; Fri, 19 Oct 2018 09:18:38 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 5ECE3813A1 for ; Fri, 19 Oct 2018 09:18:38 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Improve wording for error on too large non-local frames Date: Fri, 19 Oct 2018 09:18:35 +0200 Message-ID: <1610608.5eqqG9iB4r@polaris> MIME-Version: 1.0 The compiler currently issues a warning/error mentioning a variable "frame", which is not very user-friendly. This is changed to using the same wording as frame_offset_overflow, i.e. "total size of local objects". Tested on x86-64/Linux, applied on the mainline as obvious. Btw, in most cases, the compiler now issues both a warning and an error when a variable has too large a size. What's the rationale for this oddity? IMO it needs to make a choice here, it's either a warning or an error. 2018-10-19 Eric Botcazou * cfgexpand.c (expand_one_var): Use specific wording in error message for non-local frame variables. * stor-layout.c (layout_decl): Do not issue a warning for them. 2018-10-19 Eric Botcazou * gnat.dg/frame_overflow2.adb: New test. Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 265259) +++ cfgexpand.c (working copy) @@ -1674,7 +1674,12 @@ expand_one_var (tree var, bool toplevel, /* Reject variables which cover more than half of the address-space. */ if (really_expand) { - error ("size of variable %q+D is too large", var); + if (DECL_NONLOCAL_FRAME (var)) + error_at (DECL_SOURCE_LOCATION (current_function_decl), + "total size of local objects is too large"); + else + error_at (DECL_SOURCE_LOCATION (var), + "size of variable %q+D is too large", var); expand_one_error_var (var); } } Index: stor-layout.c =================================================================== --- stor-layout.c (revision 265259) +++ stor-layout.c (working copy) @@ -755,8 +755,8 @@ layout_decl (tree decl, unsigned int kno DECL_SIZE_UNIT (decl) = variable_size (DECL_SIZE_UNIT (decl)); /* If requested, warn about definitions of large data objects. */ - if ((code == VAR_DECL || code == PARM_DECL) - && ! DECL_EXTERNAL (decl)) + if ((code == PARM_DECL || (code == VAR_DECL && !DECL_NONLOCAL_FRAME (decl))) + && !DECL_EXTERNAL (decl)) { tree size = DECL_SIZE_UNIT (decl);