From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 810123858289 for ; Tue, 21 May 2024 07:31:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 810123858289 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 810123858289 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276668; cv=none; b=Lhbc+3oSCI3DkAM4CNlQTE+mOtn0BpX6sTRCLQSI2wra2bnerfTiz6TMoircbeoxvoDJF3GNL2yfAz+L1McnoFAPIGGlOyww+WU7zlmV166ZHNfE2d09qANbJef3mZMiSowpa4WvjvZB2xQ40AIjlvEsQC+2kc3aL9jrW8Qq+4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276668; c=relaxed/simple; bh=8gkC+UPbS8uz5JNljtoRiuZdKC3Apfvd71ft/bEvTiY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vc8hY+Gn5mmlejWyxSRoEVKrMqDS2QoN/3Uc5AabvIUPE+Q12BvcKP81Mk2YbtQJZQQA5sStgjsmpQkXUnkGE6TmTpwl1X2zMgGbD2qS2EUbCpcNIEk3XpfRsHdmhKQ/xdNG0gJ+kAm8urLViyZ41sLuK4VdLBEoKWCAR3wlnz4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4200ee78e56so27098695e9.3 for ; Tue, 21 May 2024 00:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276665; x=1716881465; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qz40HiZEjKKT6evlnA9+S+cKwMvwjAvLKE8kC96wmHU=; b=T57omQB3WdB+HXw4rZPVmFbaPn8Sf3UlbINrUU6mJfgvk8SGMbzHwBptpL813xQHmX m3Gd61rb9nryHUVV+ZfMvKMKe9xwkE4v8onPYivVYXhwi+CBCuqj32BpOpEDgCxmisTL 9Pkda9gWoa1akbaeqv0qDy+qdnJ4MI4KAlzWczxkrwSNru3H9t7S8xpLU+V45h4TPAoz VNXEhUX6c7lfvQasYn8pOxCb69UGy6s6TieKb54R28kjik4TabsO/BDTqyilpKCZljYI JwNuemMVeOtemzBtysGomZ27OsKjQ1BEjFRHi/vqgv1s9xWPgRrI3QhST2X2QGIkVOvR vEsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276665; x=1716881465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qz40HiZEjKKT6evlnA9+S+cKwMvwjAvLKE8kC96wmHU=; b=kantv7xBd1pDbfDfibm61kZ4FOuu+IEoAVYUwpwRynuj8ZxCETisiSOiPzCBowf8/B cm2tGX+lM1rvZaNGeUmMWXAZPGzONn+wpMIyGgKe5iBvVtt9ckCX47nIsENrWKXSK7hx g1LON1SngcntcEJYubrlhajl91jLFNCDpbpIR5YVZ6hegDXwkXuKgCn23Up/eIQTCETd PO9BQULId7yyTrO28ai3dPsYqzIsKtNvMMkexkooLhNJBSEehtikdQHgbqGvkPXXe/dV NQc0E8Z06LFAqW+IKRUuUILZYdgPyACvmUQan0ULGiK9H1DFWKT1E+2aurdYSWZuxUpk LoTw== X-Gm-Message-State: AOJu0Yz4yp6QSX1KOoM9M3W/WlROT8dAZbVde2slSr3xJ+MVx55DuCAB F//UU7GdkI1ja91IHGUMpzxggnGfByuonbbBkokStyTr+1fOAOcIXmqunRPDRQX65EBZ4ygkiWk = X-Google-Smtp-Source: AGHT+IG2kXsZU8BqIu8aGDKEJCf//b9P5FLxl79DYqt8VYoj4E3GODSHAFNdoXgXLcnhu5hK7aTm5g== X-Received: by 2002:a05:600c:45ce:b0:420:171c:3d70 with SMTP id 5b1f17b1804b1-420171c3e17mr186701925e9.16.1716276665331; Tue, 21 May 2024 00:31:05 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:31:04 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 23/31] ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_Proc Date: Tue, 21 May 2024 09:30:26 +0200 Message-ID: <20240521073035.314024-23-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 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 List-Id: From: Eric Botcazou The deallocation call of the return and secondary stacks no longer matches the profile built in Exp_Util.Build_Allocate_Deallocate_Proc, so this just removes the code as unreachable and adds an assertion to that effect. gcc/ada/ * gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Add an assertion that this is not a deallocation of the return or secondary stack and remove subsequent unreachable code. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index fb0ccf59224..64712cb9962 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -2187,15 +2187,16 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type, = Etype (Next_Formal (First_Formal (gnat_proc))); tree gnu_size_type = gnat_to_gnu_type (gnat_size_type); + /* Deallocation is not supported for return and secondary stacks. */ + gcc_assert (!gnu_obj); + gnu_size = convert (gnu_size_type, gnu_size); gnu_align = convert (gnu_size_type, gnu_align); if (DECL_BUILT_IN_CLASS (gnu_proc) == BUILT_IN_FRONTEND && DECL_FE_FUNCTION_CODE (gnu_proc) == BUILT_IN_RETURN_SLOT) { - /* This must be an allocation of the return stack in a function that - returns by invisible reference. */ - gcc_assert (!gnu_obj); + /* This must be a function that returns by invisible reference. */ gcc_assert (current_function_decl && TREE_ADDRESSABLE (TREE_TYPE (current_function_decl))); tree gnu_ret_size; @@ -2221,11 +2222,6 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type, N_Raise_Program_Error)); } - /* The first arg is the address of the object, for a deallocator, - then the size. */ - else if (gnu_obj) - gnu_call = build_call_n_expr (gnu_proc, 2, gnu_obj, gnu_size); - else gnu_call = build_call_n_expr (gnu_proc, 2, gnu_size, gnu_align); } -- 2.43.2