[{"id":3677228,"web_url":"http://patchwork.ozlabs.org/comment/3677228/","msgid":"<2e42efb2faf968c788e757c681821a6d880f6663.camel@redhat.com>","list_archive_url":null,"date":"2026-04-14T14:16:39","subject":"Re: [PATCH] testsuite: add explicit comparison to if statement","submitter":{"id":24465,"url":"http://patchwork.ozlabs.org/api/people/24465/","name":"David Malcolm","email":"dmalcolm@redhat.com"},"content":"On Tue, 2026-04-14 at 15:27 +0200, Torbjörn SVENSSON wrote:\n> Ok for trunk?\n\nThanks; LGTM.\n\nDave\n\n> \n> --\n> \n> Without this patch, this ends up in the logs with llvm as the default\n> compiler for the host:\n> \n> /build/gcc_src/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_pat\n> hs.cc:484:17: warning: using the result of an assignment as a\n> condition without parentheses [-Wparentheses]\n>   484 |               if (call = check_for_named_call (stmt,\n> \"acquire_lock_a\", 0))\n>       |                  \n> ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n> /build/gcc_src/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_pat\n> hs.cc:484:17: note: place parentheses around the assignment to\n> silence this warning\n>   484 |               if (call = check_for_named_call (stmt,\n> \"acquire_lock_a\", 0))\n>       |                        ^\n>       |                  \n> (                                                      )\n> /build/gcc_src/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_pat\n> hs.cc:484:17: note: use '==' to turn this assignment into an equality\n> comparison\n>   484 |               if (call = check_for_named_call (stmt,\n> \"acquire_lock_a\", 0))\n>       |                        ^\n>       |                        ==\n> ...\n> 2 warnings generated.\n> \n> gcc/testsuite/ChangeLog:\n> \n> \t* gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Compare\n> with\n> \tNULL in if statement.\n> \n> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>\n> ---\n>  .../gcc.dg/plugin/diagnostic_plugin_test_paths.cc          | 7 ++++-\n> --\n>  1 file changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git\n> a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc\n> b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc\n> index 875f4a849e8..7fa67d0bf0f 100644\n> --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc\n> +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc\n> @@ -481,12 +481,13 @@ example_4 ()\n>  \t      gimple *stmt = gsi_stmt (gsi);\n>  \t      event_location_t *evloc = NULL;\n>  \t      gcall *call = NULL;\n> -\t      if (call = check_for_named_call (stmt,\n> \"acquire_lock_a\", 0))\n> +\t      if ((call = check_for_named_call (stmt,\n> \"acquire_lock_a\", 0)) !=\n> +\t\t  NULL)\n>  \t\tevloc = (in_foo\n>  \t\t\t ? &call_to_acquire_lock_a_in_foo\n>  \t\t\t : &call_to_acquire_lock_a_in_bar);\n> -\t      else if (call\n> -\t\t       = check_for_named_call (stmt,\n> \"acquire_lock_b\", 0))\n> +\t      else if ((call = check_for_named_call (stmt,\n> \"acquire_lock_b\",\n> +\t\t\t\t\t\t     0)) != NULL)\n>  \t\tevloc = (in_foo\n>  \t\t\t ? &call_to_acquire_lock_b_in_foo\n>  \t\t\t : &call_to_acquire_lock_b_in_bar);","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=IPRsRMgf;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=IPRsRMgf","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fw5vG36fGz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 00:17:14 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6D3B64BA2E09\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 14:17:12 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 735564BA2E31\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 14:16:44 +0000 (GMT)","from mail-qt1-f200.google.com (mail-qt1-f200.google.com\n [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-125-Q5knwijJOAexKW9NFnlYNg-1; Tue, 14 Apr 2026 10:16:42 -0400","by mail-qt1-f200.google.com with SMTP id\n d75a77b69052e-50b31cff27fso17251831cf.3\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 07:16:42 -0700 (PDT)","from t14s.localdomain (c-73-38-242-98.hsd1.nh.comcast.net.\n [73.38.242.98]) by smtp.gmail.com with ESMTPSA id\n d75a77b69052e-50dd539b3f3sm111078731cf.2.2026.04.14.07.16.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 14 Apr 2026 07:16:40 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 6D3B64BA2E09","OpenDKIM Filter v2.11.0 sourceware.org 735564BA2E31"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 735564BA2E31","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 735564BA2E31","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776176204; cv=none;\n b=rWJt94RKKazzFZn51ITUTId//Djb7QkixIvQ7AxtuJe13th3OP/Z1knTi3nt4VNtThHNBcXteNJov+w2T7c5s5df3y1FLULJHP3rSEbw4RydYRdVlmKPR1ai0OtxgOVy6Hq1oAm20Ra+x8wEGaG9kgURt1Z7NrJLg8X2A+MwD0c=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776176204; c=relaxed/simple;\n bh=MZNIT1p8iDe8Wl3J2Fds1NzoORO+fIi8L/iYWkC+9x4=;\n h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version;\n b=a1idqj+ROHS6GoQKYjOQ6HjXe57ITKX3LX7HI0itUbDHY84uWSMNZln+57W/gt2t0lPNTOFHn7AtIc650DmN5rR68hMAtSKuRX8dCqaIakt9yS1tBqCNje1MaDpdCGQv1lCQZtNDIh1NVZXrBpqdM92DQJizeZf7QcOFN3FfnJo=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776176204;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=MZNIT1p8iDe8Wl3J2Fds1NzoORO+fIi8L/iYWkC+9x4=;\n b=IPRsRMgfkZjmJZl/Qi5Ci5Kw2rk1LGNrBRJIYPubWl/HpXdyPdhT4A7lN502YEfEUI6hKx\n Vu20xOs635VL4WmewO9tpgdg1zBNbP/zGjaEWIdDfbvt6wrUfPHYycMGGYgXZTMrmN7AzX\n 6avm/aalj2suacxF8X76/iv/MX7UxFU=","X-MC-Unique":"Q5knwijJOAexKW9NFnlYNg-1","X-Mimecast-MFC-AGG-ID":"Q5knwijJOAexKW9NFnlYNg_1776176202","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776176202; x=1776781002;\n h=mime-version:user-agent:content-transfer-encoding:references\n :in-reply-to:date:to:from:subject:message-id:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=4NVaQNNntFDvtdepx4pDKLK305PJsZt0MiIojSKLo9Y=;\n b=pOKP8/ABHWPR5yFM5f9M1IFCSM7o6xTMrLtEWyGi523Y0p5khzLj9wU6FoRupLb4Tf\n BHNfns8n24ScwQbpJHYx7/5ugTkIGmFv6Veq+uSjtYhpCCMt26r0+TU/eCQL88mJJFQm\n 2u2F4y07J5iAh2mmIA68aoBk4oGD9K0IGuS3iKcseME1kbsIbePbD27UkdpTLWFXnDw6\n YybZ9MOc4sFqmLO+7Baf51fmeCJ44YNBkkeolq01iJu3ic+OXGWjtdu++TKbOOdRjMio\n 34xJCA3G1y/W68e/ZuWnv5vdkxZesXJG4tNLvFgZV4xNjd5XP39tHVhLi3pJYYwC/4+b\n 1oYQ==","X-Forwarded-Encrypted":"i=1;\n AFNElJ836P31kwBJJAcXf8vZ/8JLPmxOx15Yeijsf/SXJKTTLhiqFmsfmgd+bwZhWCJHuA3SnoYBd+0+ROflUw==@gcc.gnu.org","X-Gm-Message-State":"AOJu0Yxpg3WrXCgh+31p8bVav452uqdE+5kJwfPkaOUC41WZdr4l4t6H\n gD8cc0cDXRj+/1PdCI2VrSbE99muu9EZmIgq5JiGqe96DwvPewv/9rPPEVZ9DJ/ezB1uPfXd7Z2\n kPMt5ismQ1Nb8YoeJw/ekM872slxeUcKK1cQTVh/Jgly+kR4dEY7Sq5WOcOI=","X-Gm-Gg":"AeBDieuy6JIYbO15LYL+Xb6G+x8pK4qXaPM8EYaM+yCUXW5qmwmc38s9DUtpJi6qsuW\n CPyM7/FftjSN6Urn3kpsitbZkeLyQgc6YT6V3lez57fi+6ahq+RujEpRz7X5TepAOjcwgVWUvf1\n 7qKBR4em+ZRlCdXellusiepTq81nxASs4R3aOPlsihqn36b3S5IIlf5A3RGiKgrBfo7Fm2SvkQA\n LNdfqjNCg5IXDIkNXkB3i3LW08BwXczGCZLWMcCpdTik0EU0XmwTLLNuSMrR1R6tOB/DXlRLldw\n 1jvMCxaStOJOhzmbZJBu5b453IMzLhRbP1VK0t64TLzz/tnxZuryJEOr4qsKh/gdhD7dGiGrXGv\n 5dryUuth7mX96/6L9y70CGstvGg/y+n/i1sFyd+1RifMvPYT1F9B6LUFW6gaIHw==","X-Received":["by 2002:a05:622a:1493:b0:50b:277d:efc9 with SMTP id\n d75a77b69052e-50dd5b9ac48mr273317351cf.39.1776176201715;\n Tue, 14 Apr 2026 07:16:41 -0700 (PDT)","by 2002:a05:622a:1493:b0:50b:277d:efc9 with SMTP id\n d75a77b69052e-50dd5b9ac48mr273316681cf.39.1776176201129;\n Tue, 14 Apr 2026 07:16:41 -0700 (PDT)"],"Message-ID":"<2e42efb2faf968c788e757c681821a6d880f6663.camel@redhat.com>","Subject":"Re: [PATCH] testsuite: add explicit comparison to if statement","From":"David Malcolm <dmalcolm@redhat.com>","To":"=?iso-8859-1?q?Torbj=F6rn?= SVENSSON <torbjorn.svensson@foss.st.com>,\n  gcc-patches@gcc.gnu.org, ro@CeBiTec.Uni-Bielefeld.DE","Date":"Tue, 14 Apr 2026 10:16:39 -0400","In-Reply-To":"<20260414132735.943125-1-torbjorn.svensson@foss.st.com>","References":"<20260414132735.943125-1-torbjorn.svensson@foss.st.com>","User-Agent":"Evolution 3.54.3 (3.54.3-1.fc41)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"YJ1VbHqw8j0aH31p_4o0mU8gFaFI6GCF0-yiA4IY58M_1776176202","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"base64","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]