From patchwork Mon Jan 13 12:08:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: liusirui X-Patchwork-Id: 1222100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-108628-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=PdkLBsx/; 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 47xC2g2t0hz9s29 for ; Mon, 13 Jan 2020 23:05:14 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=yqa1Wg8Sj8rP8VG/g82snOmgRmqFD+AMBQzzdTcrdWfIMO9fGtAw4 1k/Xt8Z30RWpZBi3pa1u/KaIqZVYy9r/v/e2ufMVS5IB+hZ5+JRHmB+IUsxMVc/l VNIrvXDRDGCbUPQ/3I2aRLwmAkcdK1/4DrAn6l3NOj8fBZb5uxsd5w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=/dQRxtKWPeGFatPPZpkxnjlw7nY=; b=PdkLBsx/JmPVqEP0AVNTXOY+Gh7i 4RySReHcUUNdukMgq6zxFZjYlGVjdV72bnaCF4iOYFumE8/EglXclFzC+fjREihl K6KRFUa3PCBVdKF+yObjEs2SPze4zf9wpMCUeZD/Bqag0Sy+skCV9N3zgBWhvpro kOM3CjFM2pgphOU= Received: (qmail 108576 invoked by alias); 13 Jan 2020 12:05:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 108207 invoked by uid 89); 13 Jan 2020 12:05:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:0800, unfinished, HContent-Transfer-Encoding:8bit X-HELO: huawei.com From: liusirui To: CC: , , , , Subject: [PATCH] malloc: fix compile error Date: Mon, 13 Jan 2020 20:08:27 +0800 Message-ID: <1578917307-37611-1-git-send-email-liusirui@huawei.com> MIME-Version: 1.0 Since e9c4fe93b3855239752819303ca377dff0ed0553, the commit changes struct malloc_chunk member "size" to "mchunk_size". This cause a compile error in function dump_heap, if macros MALLOC_DEBUG has defined and the value is larger 1. producing the following error message: In file included from malloc.c:1884:0: arena.c: In function ‘dump_heap’: arena.c:422:58: error: ‘struct malloc_chunk’ has no member named ‘size’ fprintf (stderr, "chunk %p size %10lx", p, (long) p->size); ^~ arena.c:428:17: error: ‘struct malloc_chunk’ has no member named ‘size’ else if (p->size == (0 | PREV_INUSE)) ^~ make[2]: *** [../o-iterator.mk:9: /opt/lsr/mainglibc/buildglibc/malloc/malloc.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:470: malloc/subdir_lib] Error 2 make: *** [Makefile:9: all] Error 2 --- malloc/arena.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/malloc/arena.c b/malloc/arena.c index 74815ac..be5c9f9 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -419,13 +419,13 @@ dump_heap (heap_info *heap) ~MALLOC_ALIGN_MASK); for (;; ) { - fprintf (stderr, "chunk %p size %10lx", p, (long) p->size); + fprintf (stderr, "chunk %p size %10lx", p, (long) chunksize_nomask(p)); if (p == top (heap->ar_ptr)) { fprintf (stderr, " (top)\n"); break; } - else if (p->size == (0 | PREV_INUSE)) + else if (chunksize_nomask(p) == (0 | PREV_INUSE)) { fprintf (stderr, " (fence)\n"); break;