From patchwork Tue Jan 19 19:35:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1428824 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=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PsjDaLkw; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DKzQ768P5z9sVR for ; Wed, 20 Jan 2021 06:35:10 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6859E3857C6F; Tue, 19 Jan 2021 19:35:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by sourceware.org (Postfix) with ESMTPS id CDBF03857C6F for ; Tue, 19 Jan 2021 19:35:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CDBF03857C6F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qt1-x832.google.com with SMTP id v3so12302465qtw.4 for ; Tue, 19 Jan 2021 11:35:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=Ss+fZ/+aruhZFvFbu9ADLZw7UpeDjhPTtZEnJhAjgxc=; b=PsjDaLkw2E0IUwt1uo2EQo9Bqhg/QTiIxDXmDoL/UCVE3pThgGuQBG1x9Xcb+0JwNh mBFBzNl9Qb5VJrKKmVnQFvkOo9I3fxeOBKnZu6vB0mWiXwTvOMBdNitWm2y09zSqiK0c PGA+Yo+3Gmcu6IMfPmVeuf58taoXd9OGOLtOAOmxCeIGGz0/YAhImzE8G2nvAmvbZwcZ hOIdvXkpRv0CXcqBnohrVYA+mMocoObAWyjCAfrTsZiv3LmiZetUmp+nWNs8QK+q6DLN 4nU3lrTT0xYJsmbT5ukDEiMProbitCcAIzrNfR6CGeNe+lCGdVtyfI21WWn1OsiZmcsI Zpxw== 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:content-language; bh=Ss+fZ/+aruhZFvFbu9ADLZw7UpeDjhPTtZEnJhAjgxc=; b=N+Zm4XIZqaB8DS8k+GKJEuUsAQ0/Bthq5foeNBGHYaEvRMlyre4Kjd6zi1OjktFB0T 6TLzscvz9iwiChqnq/BJKlMxLVLudAaCZhy4OJM7jmyADJ5IuI+11tSxwVcYi/HWbJKj hspdNcgx6aGcuVQPkGUPO+zr8/1r/X+2gJ3wJIGoIAVo8rPMWDEFEbmm2lYQu7xWnoYL 0bXnibx6r9KIEMaKHFzl9XrOBcYEmHzSkJVOCDQvD9TcLnj+SJOgIq2RetE5Si5wCca8 BxNpcPR9aTydIQLU//VOcH33P5QbZ+7OnzMb8kXmdg+tnACi7grEkJVzWhVVG6dMZUri oXgg== X-Gm-Message-State: AOAM533a4BlhhWh87yrWNlsVn01Mwy2sfn1A3Km7OPwp7fXx8OgfRwZk XYocMWzgG0rmwbxCOHF+65c= X-Google-Smtp-Source: ABdhPJwhh5mixDBMav4opU5cVC3KcdlUkugvrBHO2Y06ett9shgldZ7hPciiQCJ8TCjQrFPa95Igsg== X-Received: by 2002:ac8:1184:: with SMTP id d4mr5697569qtj.103.1611084904392; Tue, 19 Jan 2021 11:35:04 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:2d44:c1cd:58a0:3f? ([2620:10d:c091:480::1:d708]) by smtp.googlemail.com with ESMTPSA id y16sm13448203qki.132.2021.01.19.11.35.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 11:35:02 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: Fix null this pointer [PR 98624] Message-ID: <363e63bd-6cd4-86d5-67da-386ad7ca0cda@acm.org> Date: Tue, 19 Jan 2021 14:35:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" There's no need for this function to have an object, so make it static and avoid UB. gcc/cp/ * module.cc (trees_out::write_location): Make static. diff --git i/gcc/cp/module.cc w/gcc/cp/module.cc index 1fd0bcfe3eb..3b224b616c1 100644 --- i/gcc/cp/module.cc +++ w/gcc/cp/module.cc @@ -3727,7 +3727,7 @@ class GTY((chain_next ("%h.parent"), for_user)) module_state { static cpp_macro *deferred_macro (cpp_reader *, location_t, cpp_hashnode *); public: - void write_location (bytes_out &, location_t); + static void write_location (bytes_out &, location_t); location_t read_location (bytes_in &) const; public: