From patchwork Tue Nov 21 10:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 167633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp525353vqb; Tue, 21 Nov 2023 02:30:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGO3Q0qgIEdeyX/9bCquc8wjlDKy2HlDjEdFeyINp7vgZL/lN+Gi22V9FUBWSiNRV06ITbL X-Received: by 2002:a05:620a:1d86:b0:77b:d625:601f with SMTP id pj6-20020a05620a1d8600b0077bd625601fmr10152903qkn.3.1700562638810; Tue, 21 Nov 2023 02:30:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700562638; cv=pass; d=google.com; s=arc-20160816; b=MO1MlQzv0QGrzyRbHXe3gQUJFH1lJWv2CMzZwtmgLuFJTlufAhy8bXipMFmiNO4bhl cDwkKYJkRKfznykMGnLPHxp3OU2Gb1wCsbCw6jsmwBCqo3Q69shLM3Tj4dbDUhDFyYfd g/26tga4haGnmYObO42vGBPzhtDWzL9yIQP71m04qcUukxzSQQ8yRAkUKOkCC4sUajsF ZpD8rufX6vERaX7eI341HL5we2Qr9+VQOFYQyeSEWjRJGrKuCX0vD8ZEHeYeUV73EKmV yaOY7ToPqTCQOJpPToLCJ14NlJuwGfoZY/MV7E+DaKEETlrLFN+5DC0BF1dXBMtaDEfk AFyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=J8WBPR403acuCQ+a8EW67CU11QYrAx3+EVW6HA4LLC8=; fh=mPdDfEriP5euamZUSw2lHlcLGWv1xzfYWzeKdHoOsLE=; b=quLVwH7Q6/bQeI3+/SIRGtjlF3CnEkKrOTtxJE/WBf3i1VGgI4KvCgFgnbgjwk9hpz Fx0yvbM7lYj0bK4knDkhIMvhxoIqRYzeTOzLUvCP09kYKEhXQf4nu/vkKuViWWQxUH92 Fz9yfGGS7DkhinkGIeV8ppR2fGxbz/UV3025QZ+iGFycfMPI1Cw18gZBU+pMwix0BNbB KBzBf9p+vOZaViPh8lEXZopeoynisHsncs5hKsQUv3CZTJnknM98zp4mulTQY4XUQBrR PSiZNx01STXf/2Ey+CTPv/Lja23OIXonl95+OadEJNV8Lys4DV3tZxEBEy55rQZmZ8Wd G/Bw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id pc21-20020a05620a841500b007770bfd349fsi8695027qkn.603.2023.11.21.02.30.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:30:38 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 89C503858CDB for ; Tue, 21 Nov 2023 10:30:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id B4B833858D39 for ; Tue, 21 Nov 2023 10:30:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4B833858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B4B833858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=85.10.215.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700562615; cv=none; b=IbcW4pqiU5VaT9RWq7l0NgDb8pAR0hMqVyUD3unPC+XqK/IHuhU1Z6YE3RW/9fcYr9SqgQVG6LEde5CVGHarqns3/cG7/q+HYrtjmwhA0QnJPMJ6Edj9SQzKJcJX2uoNLTw/tDLNTi+x7o5/v5q5NgRDCcFKsEMCb9JK0IKVEnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700562615; c=relaxed/simple; bh=5Jq64KkKm9KD5d27d4GQDpHYFVSnjXONqVTCIDjS9XY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=qGQhc+EIe80/EFoa9gL7m9csZ+sKUySlwEtYakrLaQ7y6YeTbk2BtobQ46eFjSlQEGZj+0yQZ2cCRtdWtD7M7qEyb2AmivuyNt5U9+Q6uu/iU1AKnj5QGLeaMfLjGNl57XVeFmrKJSZVBcyG4T4CViLy6NFlQZjm1Fug/jxBXNI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from sslproxy01.your-server.de ([78.46.139.224]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5O1A-000CVp-Vd; Tue, 21 Nov 2023 11:30:08 +0100 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r5O1A-000LhM-39; Tue, 21 Nov 2023 11:30:08 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 8664B48015D; Tue, 21 Nov 2023 11:30:02 +0100 (CET) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id f9SelmL0KmTF; Tue, 21 Nov 2023 11:30:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id EC7904801BE; Tue, 21 Nov 2023 11:30:01 +0100 (CET) X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id s4HVt26KLOQ0; Tue, 21 Nov 2023 11:30:01 +0100 (CET) Received: from zimbra.eb.localhost (unknown [192.168.96.242]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 7CEFE48015D; Tue, 21 Nov 2023 11:30:01 +0100 (CET) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek , Dimitar Dimitrov , Tobias Burnus Subject: [PATCH v2] gcov: Fix integer types in gen_counter_update() Date: Tue, 21 Nov 2023 11:29:58 +0100 Message-Id: <20231121102958.53303-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.10/27100/Tue Nov 21 09:39:58 2023) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783169169245805298 X-GMAIL-MSGID: 1783169169245805298 This change fixes issues like this: gcc.dg/gomp/pr27573.c: In function ‘main._omp_fn.0’: gcc.dg/gomp/pr27573.c:19:1: error: non-trivial conversion in ‘ssa_name’ 19 | } | ^ long int long unsigned int # .MEM_19 = VDEF <.MEM_18> __gcov7.main._omp_fn.0[0] = PROF_time_profile_12; during IPA pass: profile gcc.dg/gomp/pr27573.c:19:1: internal compiler error: verify_gimple failed gcc/ChangeLog: PR middle-end/112634 * tree-profile.cc (gen_assign_counter_update): Cast the unsigned result type of __atomic_add_fetch() to the signed counter type. (gen_counter_update): Fix formatting. --- v2: Use NOP_EXPR to do the cast. Fix formatting. gcc/tree-profile.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc index f12b374ca27..ff95f8ef7cd 100644 --- a/gcc/tree-profile.cc +++ b/gcc/tree-profile.cc @@ -281,10 +281,13 @@ gen_assign_counter_update (gimple_stmt_iterator *gsi, gcall *call, tree func, if (result) { tree result_type = TREE_TYPE (TREE_TYPE (func)); - tree tmp = make_temp_ssa_name (result_type, NULL, name); - gimple_set_lhs (call, tmp); + tree tmp1 = make_temp_ssa_name (result_type, NULL, name); + gimple_set_lhs (call, tmp1); gsi_insert_after (gsi, call, GSI_NEW_STMT); - gassign *assign = gimple_build_assign (result, tmp); + tree tmp2 = make_ssa_name (TREE_TYPE (result)); + gassign *assign = gimple_build_assign (tmp2, NOP_EXPR, tmp1); + gsi_insert_after (gsi, assign, GSI_NEW_STMT); + assign = gimple_build_assign (result, gimple_assign_lhs (assign)); gsi_insert_after (gsi, assign, GSI_NEW_STMT); } else @@ -309,8 +312,8 @@ gen_counter_update (gimple_stmt_iterator *gsi, tree counter, tree result, { /* __atomic_fetch_add (&counter, 1, MEMMODEL_RELAXED); */ tree f = builtin_decl_explicit (TYPE_PRECISION (type) > 32 - ? BUILT_IN_ATOMIC_ADD_FETCH_8: - BUILT_IN_ATOMIC_ADD_FETCH_4); + ? BUILT_IN_ATOMIC_ADD_FETCH_8 + : BUILT_IN_ATOMIC_ADD_FETCH_4); gcall *call = gimple_build_call (f, 3, addr, one, relaxed); gen_assign_counter_update (gsi, call, f, result, name); }