From patchwork Tue May 2 22:41:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 757823 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wHbqk6VlPz9s7j for ; Wed, 3 May 2017 08:41:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qiJAzmTU"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=FNqgGlsGGrr14P2zTB2wpofi70M4of/hnBtDbJMLA3M1Ufobm5 d9oJ/6ORjrlOLE2iPpDYHFSykeZLE8rDYogXkZ9FBThaq/VDeOPMzZAPF9dGoFDJ 3AQnLWjd/nJCPxN7M/5pl0qzqsnWH7X/KVZgpBzC5S7rtakNgIhMAxVSI= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=hlqfharA+8rkxh1FoVJnATyl+/E=; b=qiJAzmTUcW4IoFXITMyA hxHw+3l3MBIYnYg620Ev5KF+7+XuRXygtxNPbZ6RlJog5mOxOpnF10zpLQzXUhXa yc6AS9q+FA7d+GZmCYNnCrjZIGqiqIeFd8th2AsueSb3jEaoFfAnD7/XVIQC9pV1 OYy7yzzcdYP1tEpVjXLC+wk= Received: (qmail 122641 invoked by alias); 2 May 2017 22:41:07 -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 121482 invoked by uid 89); 2 May 2017 22:41:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f175.google.com Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 May 2017 22:41:04 +0000 Received: by mail-qk0-f175.google.com with SMTP id u68so1465030qkd.0 for ; Tue, 02 May 2017 15:41:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version; bh=qqWFuyhBwrut4oPfoknfy+cLoaMTS0qrAJ6D/xCgSPE=; b=hQMcRx1KmLrUzbbQpz+CKUKIBjv/md7QvLLjxca9r/tmYKrvOmQJclcYlIOYXhe8zm 1fz9KytN65nJXp5BWdXbS5FzTfdTji9u7zAKnvE9J4s6NTJ8kKReOhJ79P1NhJSHSDY9 0lDsdHHjp6rnukvnfYZ/0RrvAQIh+fIGppNDDXcohDlB7754985nqpqgN7dGnGERLwsv H7Gy+0M+v4g7xIVlEaKLLzaMfAVD2IL5k0mhNFCxIQZTEeNPW7yClLaUPUREvqVuxbeY /Y2reqVdNY3t4jPty2UUP/DG+K0o5IvTnZPW1LOQzZLozJoMEeryXsIe9FUDMXwfjwBw /1cw== X-Gm-Message-State: AN3rC/68xn948It2walXRQnrTZoTl5Wcsj+jDHOMHadzIcUHh1idPnMa KsdQ4evTfKBjXiea X-Received: by 10.55.102.197 with SMTP id a188mr215338qkc.243.1493764865618; Tue, 02 May 2017 15:41:05 -0700 (PDT) Received: from ?IPv6:2601:181:c480:b5c0::ff0e? ([2601:181:c480:b5c0::ff0e]) by smtp.googlemail.com with ESMTPSA id i13sm131960qke.47.2017.05.02.15.41.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 15:41:05 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [PATCH] ggc-page loop Message-ID: <075b8346-d1fa-719a-4a6f-6d0391c15e9c@acm.org> Date: Tue, 2 May 2017 18:41:04 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 This loop in ggc-page confused me, because the iterator is one greater than the indexing value. Also the formatting of the array indexing is incorrect. Fixed thusly, and applied as obvious after booting on x86_64-linux-gnu nathan Index: ggc-page.c =================================================================== --- ggc-page.c (revision 247528) +++ ggc-page.c (working copy) @@ -2507,8 +2507,6 @@ ggc_pch_finish (struct ggc_pch_data *d, static void move_ptes_to_front (int count_old_page_tables, int count_new_page_tables) { - unsigned i; - /* First, we swap the new entries to the front of the varrays. */ page_entry **new_by_depth; unsigned long **new_save_in_use; @@ -2536,10 +2534,10 @@ move_ptes_to_front (int count_old_page_t G.save_in_use = new_save_in_use; /* Now update all the index_by_depth fields. */ - for (i = G.by_depth_in_use; i > 0; --i) + for (unsigned i = G.by_depth_in_use; i--;) { - page_entry *p = G.by_depth[i-1]; - p->index_by_depth = i-1; + page_entry *p = G.by_depth[i]; + p->index_by_depth = i; } /* And last, we update the depth pointers in G.depth. The first