From patchwork Tue Dec 5 02:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 844537 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-468486-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="J8QawbGg"; 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 3yrQ5h4x3Nz9s9Y for ; Tue, 5 Dec 2017 13:03:49 +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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=J7A0LfJDPC6jeYBo/Ru5fL59fYTkxSmsW3vKEEpQTYEQBX tLMl/m2vUfupYox07T/0PEHaWpEgcsoPAOZLf+FlfOcFQW6Bh0DwhlqSo6n4c34G kFUNOOITF1tBfh4nrhwC62SbpZpoqD2+G1erpAlDeYhIKICxctTp6j1xGpalQ= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=Ey/EqZLukgoNkKuE0JAxukcM1aU=; b=J8QawbGg88TWAAwlhQls g1uJMgow/je2Jay3MhUAbtl13QT8u/8RMrCItgoY4PcLL5Gh/okrgs97BDoXJzDU 0yNfNy3xjOpeMKq73VgeyVO2xM9QKUQcyehI3H90tx9jRHDuUKuuE2mVsg8nKI2R zLx5GR8DoYNl49mah7tjhdI= Received: (qmail 26726 invoked by alias); 5 Dec 2017 02:03: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 25765 invoked by uid 89); 5 Dec 2017 02:03:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 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=255347, H*r:10.80.179 X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Dec 2017 02:03:30 +0000 Received: by mail-wm0-f46.google.com with SMTP id l141so9213149wmg.1 for ; Mon, 04 Dec 2017 18:03:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3m//6fGZLLXWCX9Gd1YFssLiNAxmXhXLq01SeYCYawg=; b=srWLVQmWRTfhZSTGLhVNJgOU9ahq5Ser3wTkYOlb6MYFOe3MWMHO3RBNfK9HmqRgIX z7+kG+rbnXuRGyDQNf+HmPAQD8jw7NYU/uDbpJyWFFOMIbnx1R9WwvuhnCqtVWYHiIaS 9f/q9tvL42eDeqgqVDBIb9NZ1kPZQDU1LNiueIuNny8ZTaxabkp3I7lZJkHPpJS0IENS 2MR3GYcWp3OqYi2iu2xJ5EEbH1ZbVHoRo+S4yIwbL5brO7COMy6porY7er0EDFJ/2oV5 AJ1HOJD/YPIZ1PDziP8AEDCS+X1cFrX/0uOZdnnTU15jP2IBRroEuHmH3hInZ8k3+k73 Nu1Q== X-Gm-Message-State: AJaThX5OhejCW0larwm2opVgncOjHATJuvqp/3HbG5u+iBPPt5JooBJE Xm8wiWflIwmnPpskPGMNTYrUglPCXYMYETG98FXXHi1H X-Google-Smtp-Source: AGs4zMZcO882Pwq7QTj4iWiUeWmP2TZQysM6IzAlkHQKjIK+++bx1J4kjo6MBaBNM/C643/xgAVHQDv5+g8XmiYx5Go= X-Received: by 10.80.135.26 with SMTP id i26mr33200515edb.31.1512439408352; Mon, 04 Dec 2017 18:03:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.179.221 with HTTP; Mon, 4 Dec 2017 18:03:27 -0800 (PST) From: Ian Lance Taylor Date: Mon, 4 Dec 2017 18:03:27 -0800 Message-ID: Subject: Go patch committed: Omit nil check when dereferencing closure variable To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch to the Go frontend by Than McIntosh adds the "no nil check needed" annotation to the dereference operations created in Parse::enclosing_var_reference (this is safe since the closure object is under control of the compiler, and pointer fields in it will always be non-nil). Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 255347) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -338f7434175bb71f3c8905e9ad7f480aec3afee6 +297cf346f2400274946650ab9ecd039427fc986b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/parse.cc =================================================================== --- gcc/go/gofrontend/parse.cc (revision 255340) +++ gcc/go/gofrontend/parse.cc (working copy) @@ -2747,7 +2747,7 @@ Parse::enclosing_var_reference(Named_obj location); closure_ref = Expression::make_dereference(closure_ref, - Expression::NIL_CHECK_DEFAULT, + Expression::NIL_CHECK_NOT_NEEDED, location); // The closure structure holds pointers to the variables, so we need @@ -2755,7 +2755,8 @@ Parse::enclosing_var_reference(Named_obj Expression* e = Expression::make_field_reference(closure_ref, ins.first->index(), location); - e = Expression::make_dereference(e, Expression::NIL_CHECK_DEFAULT, location); + e = Expression::make_dereference(e, Expression::NIL_CHECK_NOT_NEEDED, + location); return Expression::make_enclosing_var_reference(e, var, location); }