From patchwork Wed Dec 14 22:56:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 88079 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp466111qgi; Wed, 14 Dec 2016 14:56:49 -0800 (PST) X-Received: by 10.98.211.67 with SMTP id q64mr108734051pfg.173.1481756209724; Wed, 14 Dec 2016 14:56:49 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l24si15104143pfk.178.2016.12.14.14.56.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 14:56:49 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444462-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444462-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444462-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com 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=JX1tQhJ0Qz/Ka2aw1/x6H43L2LFsKFXuZ9hmsIARPpVfzzdhpg z1mqo8QzPyuLCw3rowb/kU35//KL0sdgCPzs08btoXznRW8DKTW4BW0vcBvwUqgd zBAbqqoYWapWdYLpqxAClqdAHHtQzduPdd53/XsiG6GmXHdxjcuS6gNWE= 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=hBo79kp+uIwa4dhAsP5VgIVkZy8=; b=V99cvO9x2BdQkFLelY4n zJhiy1PjBY5d2/Iv4xz8Zs/3dlA4ySJEcOyhuAXB0p/Trh17OfKsvphM/v7lRYAv 2g3o74+26KR0NSuXF8pGxOafacvJOo3bD+tpJRDdFMAjCE06K9IG9pLEhfaqLqHB rBDTfo9H7L1yLokf4htFhQU= Received: (qmail 51187 invoked by alias); 14 Dec 2016 22:56:38 -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 51176 invoked by uid 89); 14 Dec 2016 22:56:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2010, his X-HELO: mail-qt0-f178.google.com Received: from mail-qt0-f178.google.com (HELO mail-qt0-f178.google.com) (209.85.216.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Dec 2016 22:56:36 +0000 Received: by mail-qt0-f178.google.com with SMTP id w33so40276859qtc.3 for ; Wed, 14 Dec 2016 14:56:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=/I7baCBaecsGCopAhspM2gD9xDY6UkcQ8Y5YEJrtt9w=; b=m8OuFswXCL0DSPIt8xzKhcxLQco+croIRCoe4B2Fplsg8IFCTsfD4oNF0cT5Yxy8nT zHfBc6aNXW57Es4PTdgm5hO9YzTkD+kQd8GkT3Tzw/cPLF9+Y5V/qNYf4GYj6vv9p0ZG qsIWhIEM3fYtJ+N6d39XWHgCDRavwfK/hzTNiJJflnOomnhvRMdGqhX2mTgT+XlTrxZx N0KVHn3Enpa+5B0/hmo18abaypcaCfZTMBS1o15BdV6ROo+ZtriZG+ok4SOzrw+lLIaH 1fsbXyJFJ6ikdy2ou5hIsBFcfUb+DwjcRlVAKtml5YmMvipBnRg5a44aALni1EvsAUXJ ovFw== X-Gm-Message-State: AKaTC030CpsSKQ0zSgJYDh7EU5kYU7LnhVidaprS2uDYxd867xSq8aPxCoxXzYEE15KjWA== X-Received: by 10.200.43.120 with SMTP id 53mr85802519qtv.253.1481756194478; Wed, 14 Dec 2016 14:56:34 -0800 (PST) Received: from [192.168.0.26] (97-124-188-210.hlrn.qwest.net. [97.124.188.210]) by smtp.gmail.com with ESMTPSA id a69sm32761666qkj.38.2016.12.14.14.56.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 14:56:33 -0800 (PST) To: Jeff Law , Gcc Patch List From: Martin Sebor Subject: [PATCH] fix powerpc64le bootstrap failure caused by r243661 (PR 78817) Message-ID: <47244405-9a99-a24b-f2f1-6b18343ec18d@gmail.com> Date: Wed, 14 Dec 2016 15:56:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-IsSubscribed: yes The -Wnonnull warning improvement (PR c/17308 - nonnull attribute not as useful as it could be) causes a couple of false positives in a powerpc64le bootstrap. The attached fix suppresses them. It passes bootstrap on powerpc64le but tests are still running. I couldn't reproduce the bootstrap comparison failure that Segher mentioned in his comment on the bug. I've gone over the patch again to see if I could spot what could possibly be behind it but couldn't really see anything. Jeff, you mentioned attribute nonnull is exploited by the null pointer optimization. Do you think it could possibly have this effect in GCC? Martin PR bootstrap/78817 - stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661 gcc/ChangeLog: PR bootstrap/78817 * vec.h (vec::quick_grow_cleared): Assert postcondition. ( vec::safe_grow_cleared): Ditto. diff --git a/gcc/vec.h b/gcc/vec.h index aa93411..80a6ef0 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1092,10 +1092,16 @@ inline void vec::quick_grow_cleared (unsigned len) { unsigned oldlen = length (); - size_t sz = sizeof (T) * (len - oldlen); - quick_grow (len); - if (sz != 0) - memset (&(address ()[oldlen]), 0, sz); + gcc_checking_assert (oldlen <= len); + + if (size_t sz = sizeof (T) * (len - oldlen)) + { + quick_grow (len); + + T *p = address (); + gcc_assert (p != NULL); + memset (p + oldlen, 0, sz); + } } @@ -1607,10 +1613,16 @@ inline void vec::safe_grow_cleared (unsigned len MEM_STAT_DECL) { unsigned oldlen = length (); - size_t sz = sizeof (T) * (len - oldlen); - safe_grow (len PASS_MEM_STAT); - if (sz != 0) - memset (&(address ()[oldlen]), 0, sz); + gcc_checking_assert (oldlen <= len); + + if (size_t sz = sizeof (T) * (len - oldlen)) + { + safe_grow (len PASS_MEM_STAT); + + T *p = address (); + gcc_assert (p != NULL); + memset (p + oldlen, 0, sz); + } }