From patchwork Mon Mar 4 10:49:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1907500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fIkuuRWx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TpFq2138nz23l2 for ; Mon, 4 Mar 2024 21:50:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F380D3858C54 for ; Mon, 4 Mar 2024 10:50:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id AC8843858C50 for ; Mon, 4 Mar 2024 10:50:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC8843858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC8843858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709549403; cv=none; b=XXyJxa9VKV0R0jpreuFofp0m4v9xsgF6PACM8hpMM44W5rE227R2VWAChAIRt0CzPFnw6gwTB3fZhoB6Nuq72svJWw6a2/IvZbDP8wvKp5RKTuUXOi8t9ZMhv9z2+5RCTOYP7hXgfqBDAgHSICu8zBqkzWh9qTGPlf6enN9DvhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709549403; c=relaxed/simple; bh=0QceQAoaxTbeevFnq4sP2KIqtea/DxP5GjSzg9+ud3I=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=uX1+EF++r87pbDWPrxUSLFpbpKDiKBZWqe3oa/cegzqT0SC9cN07zn/bM2osL5CHMviT1H9dYQyCMaMW/bt/+/glzZGm0CUirYtvN/8U8Hp1sJwLU9NKj7yxqaCbCz/xDlWHUuPV3ojV/YJ3BcQdSv6igAOey03x8vy+w6GdSMM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709549401; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type; bh=seluRuFWlkNthKyXpLl9Gwf9ymkjPFsnSh1/k/3ZEjQ=; b=fIkuuRWx1AQ7EDK2TO4ZzuiNfM9K2nLKYcRzfprG2Jk7akmQD2YKd0r9E9Li3NtGhwhmFv idlhYg2kQkxGuPUPIAbyWoCG/m7IwTReo0J5HujcUMAccbAsG7cEpo+F7e+tMciN3msuC7 wds2BYipg1H+3KrLqAUgpmdtNPuE82M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-W6dQMxxXNbK636FLZ1hHjA-1; Mon, 04 Mar 2024 05:49:59 -0500 X-MC-Unique: W6dQMxxXNbK636FLZ1hHjA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D8A0D106522C for ; Mon, 4 Mar 2024 10:49:58 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.226.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F22C4400D for ; Mon, 4 Mar 2024 10:49:58 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 424AnumI1794869 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 4 Mar 2024 11:49:57 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 424AnuI31794868 for gcc-patches@gcc.gnu.org; Mon, 4 Mar 2024 11:49:56 +0100 Date: Mon, 4 Mar 2024 11:49:56 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] libgomp: Use void (*) (void *) rather than void (*)() for host_fn type [PR114216] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! For the type of the target callbacks we use elsehwere void (*) (void *) and IMHO should use that for the reverse offload fallback as well (where the actual callback is emitted using the same code as for host fallback or device kernel entry routines), even when it is also ok to use void (*) () before C23 and we aren't building libgomp with C23 yet. On some arches perhaps void (*) () could result in worse code generation because calls in that case like casts to unprototyped functions need to sometimes pass argument in two different spots etc. so that it deals with both passing it through ... and as a named argument. Tested on x86_64-linux, committed to trunk. 2024-03-04 Jakub Jelinek PR libgomp/114216 * target.c (gomp_target_rev): Change host_fn type and corresponding cast from void (*)() to void (*) (void *). Jakub --- libgomp/target.c.jj 2024-01-03 12:07:47.812094729 +0100 +++ libgomp/target.c 2024-03-04 11:26:05.745094586 +0100 @@ -3447,7 +3447,7 @@ gomp_target_rev (uint64_t fn_ptr, uint64 if (n == NULL) gomp_fatal ("Cannot find reverse-offload function"); - void (*host_fn)() = (void (*)()) n->k->host_start; + void (*host_fn) (void *) = (void (*) (void *)) n->k->host_start; if ((devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) || mapnum == 0) {