From patchwork Thu Oct 3 13:48:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 1992342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=oLbz7j8Q; 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 4XKChS68gXz1xtk for ; Thu, 3 Oct 2024 23:49:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 753E73865473 for ; Thu, 3 Oct 2024 13:49:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) by sourceware.org (Postfix) with ESMTPS id E12E4385DC3C for ; Thu, 3 Oct 2024 13:48:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E12E4385DC3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E12E4385DC3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727963330; cv=none; b=v2mA4tlwDChMrw5yq/wF30az5O+s+EMNb0ub+RT75v/bzHQdxLjlSZVM0CUBTLUHfv+SbyH5hTzIfCOWHEmwLR9+gaAHTPKzyxiJs18bEXc0J3YlgKU3MdsAElfejWJ/eZyrflH2pvkYibp6A6wWYMnWQxW6m7R3wdR3KH9dVbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727963330; c=relaxed/simple; bh=6bI8dEjlBjWuWPmWVOefAD0lzQxJ+80/49ZWOnaGls4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=dma7LUff9hD1XjDJo15t8WKKJZtk5n8MIrqd7I8z39qLTdQRnpM9eC8lF9bda+Wky3QYpLmdnFWdWSrtwgMBLAlvPTKQFuA1srs2OdkA0NSgI5DhybuWBBiTv/CeZv44v3hZsg82QJufiSZARlyosTFgSau2ZF9EamEqNGCpU6U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5e7c88a9af8so104285eaf.1 for ; Thu, 03 Oct 2024 06:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727963324; x=1728568124; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+HhA9GzPttmdCPigVSvID3JvIh20sLQhtCMSIxaRfLA=; b=oLbz7j8QRbflBqrqO7GdSXTd4FEIn1Eue6s8R/ACQVswIMw/56k/B4+quyJ8gvxuE4 ZNLae6O0VDqPnX5SXBqvZpxR7bJq5OADvRFEgpnWtkuKmKLHNE0TY/09hgBbaTMjG4Oa U4p7ddhmCJiWbTxbFvG3briUWgVoDDYfY1RcRJEFW5b96xYgj1qWnmxYQFjehWVMf7pD EaQ+o1Y03hIFC1K4FpZrkIfYLa7qbRUWG/piIOHu/0PLVl5Mjucbdm6fPPVsk3gPNHq0 ZTelBqyL0DaxG2YY8eb383SfBmUMgFm53RMwljKtAUVclL2remIUEsgBNHxr+rk4UYMe 3W1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727963324; x=1728568124; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+HhA9GzPttmdCPigVSvID3JvIh20sLQhtCMSIxaRfLA=; b=S1NWWUl68VSV2tK8QfmPX5wvSLGpInYWEVX7EqTlG2U7KP7xtCIeW8OJYI6r+tQrmS B6e/8K9fa+G0RlBQPfY/jF9ZIe7l5a9EDQI0lXXPpJf8jl0bvOukBUOEBCYy4yQopaqM hsZHu7j+LW1FmmxuehxZgHN5SROuWIHQ43jBWqxvJYBp9y8TeaAp2iT21Ww6p+lPbvrR 7lwHaGI2XIhWhlB7ZiKqyUpSa6DFreCBfn1AQxdAjbcdBawmm9V+s+MADyb3cN9Hk2lo 4GAYrXCU9xIOVI3vx6r/AYO1A9lrI4aJy12gOK5nmRJwEDzwrWH0vJWH5YUjaQr9rzRl i+ZQ== X-Gm-Message-State: AOJu0Ywmnkti+MmsggszT3pIXjehYi2GYJdyPnvob5t4ySBhxbLfsBV4 554bggfmhcvdIw4J1d63klW9IEWTiDSdjOsKfD7S7Va0UY4oFUCsuYyaSi0a5X60DXEys0GWfVD eXIaqOQ== X-Google-Smtp-Source: AGHT+IFAPW7lRA/9OvFC2K9agtAY/Koo0UzqVpBQ4QTJlz7utbfFMRlJqM26f9TGjrK8ns4gaqB0Zw== X-Received: by 2002:a05:6820:1ca9:b0:5e7:c925:b07 with SMTP id 006d021491bc7-5e7c925112cmr249989eaf.5.1727963324079; Thu, 03 Oct 2024 06:48:44 -0700 (PDT) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71547f893a9sm326801a34.77.2024.10.03.06.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 06:48:43 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org, andi@firstfloor.org Cc: Christophe Lyon Subject: [PATCH] testsuite: Fix tail_call and musttail effective targets [PR116080] Date: Thu, 3 Oct 2024 13:48:35 +0000 Message-Id: <20241003134835.627238-1-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Some of the musttail tests (eg musttail7.c) fail on arm-eabi because check_effective_target_musttail pass, but the actual code in the test is rejected. The reason is that on arm-eabi with the default configuration, the compiler targets armv4t for which TARGET_INTERWORK is true, making arm_function_ok_for_sibcall reject a tail-call candidate if TREE_ASM_WRITTEN (decl) is false. For more recent architecture versions, TARGET_INTERWORK is false, hence the problem was not seen on all arm configurations. musttail7.c is in turn rejected because f2 is recursive, so TREE_ASM_WRITTEN is false. However, the same code used in check_effective_target_musttail is not recursive and the function body for foo has TREE_ASM_WRITTEN == true. The simplest fix is to remove the (empty) body for foo () in check_effective_target_musttail. For consistency, do the same with check_effective_target_tail_call. gcc/testsuite/ChangeLog: PR testsuite/116080 * lib/target-supports.exp (check_effective_target_tail_call): Remove foo's body. (check_effective_target_musttail): Likewise. --- gcc/testsuite/lib/target-supports.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f92f7f1af9c..d8cdac97b6f 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -12883,7 +12883,7 @@ proc check_effective_target_frame_pointer_for_non_leaf { } { # most trivial type. proc check_effective_target_tail_call { } { return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand { - __attribute__((__noipa__)) void foo (void) { } + __attribute__((__noipa__)) void foo (void); __attribute__((__noipa__)) void bar (void) { foo(); } } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. } @@ -12893,7 +12893,7 @@ proc check_effective_target_tail_call { } { # is supported at -O0. proc check_effective_target_musttail { } { return [check_no_messages_and_pattern musttail ",SIBCALL" rtl-expand { - __attribute__((__noipa__)) void foo (void) { } + __attribute__((__noipa__)) void foo (void); __attribute__((__noipa__)) void bar (void) { [[gnu::musttail]] return foo(); } } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. }