From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22820 invoked by alias); 16 Aug 2011 05:52:17 -0000 Received: (qmail 22811 invoked by uid 22791); 16 Aug 2011 05:52:16 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Aug 2011 05:52:00 +0000 Received: by vwe42 with SMTP id 42so3650732vwe.20 for ; Mon, 15 Aug 2011 22:51:58 -0700 (PDT) Received: by 10.52.23.40 with SMTP id j8mr4169393vdf.510.1313473918087; Mon, 15 Aug 2011 22:51:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.161.101 with HTTP; Mon, 15 Aug 2011 22:51:38 -0700 (PDT) In-Reply-To: References: From: Laurynas Biveinis Date: Tue, 16 Aug 2011 05:52:00 -0000 Message-ID: Subject: Re: ggc_alloc_rtvec_sized allocates spaces more than necessary? To: Richard Guenther Cc: =?UTF-8?B?546L5Lqu?= , gcc@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00282.txt.bz2 > On Mon, Aug 15, 2011 at 2:16 PM, =E7=8E=8B=E4=BA=AE = wrote: >> The size it allocates is >> >> =C2=A0(sizeof (struct rtvec_def) + ((NELT) - 1)) * sizeof (rtx) >> Originally, the allocated size is >> >> =C2=A0sizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx) Yes, this is correct, good catch. >> =C2=A0(sizeof (struct rtvec_def) + sizeof (rtx) - 1) / sizeof (rtx) + >> ((NELT) - 1) =C2=A0 // (3) Due to the way those macros expand, right now replacing the first arg with "1" and the second one with straightforward "sizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx)" will work and will be easier to read than division. Liang, would you submit such patch? Thanks again, --=20 Laurynas