From patchwork Mon Aug 19 08:38:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1149102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507215-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="s1JvmDfk"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46BnQm6ScDz9s3Z for ; Mon, 19 Aug 2019 18:39:09 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Yk3Zdz+1F+iOrjySHmlkmXu/AHCR9dckfKiBUP5HQD9jUrPC7n JVGJ+wSR6DTYJVMgVVChzFJ4jCSlz6kJ5zYgQqPi6/z/S7MxxYsfJZ7AsTIy3/D6 tOTYAn7vbJ8GAAmkhx3NixhXUKnMipfjF7/lsoklRREyquRV0QfWRcUXY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=QnJ/yzRxFZel24tzZi47iDpIdig=; b=s1JvmDfkR3a73ORR3JmA +8sve1H9Iy5tGcnMVntLY/Hy5f1A8iKYr6Dh4bIFfPyyrIgPPpFBX6dXq+opAD8e bOFQoBFF83Ol0tHf7naVYeQWeePF1bzrE/+nIa4F2DpBFNmcE/8I4z1VfjQQidmq 9+tItNKhM0jkDf2T1l6B5jE= Received: (qmail 114720 invoked by alias); 19 Aug 2019 08:39:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 114711 invoked by uid 89); 19 Aug 2019 08:39:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=crashes, transc, UD:trans.c, trans.c X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Aug 2019 08:39:00 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 072491161B8; Mon, 19 Aug 2019 04:38:59 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id maUtp2xKsJMx; Mon, 19 Aug 2019 04:38:58 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id E760011619A; Mon, 19 Aug 2019 04:38:58 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id E29336AB; Mon, 19 Aug 2019 04:38:58 -0400 (EDT) Date: Mon, 19 Aug 2019 04:38:58 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Olivier Hainque Subject: [Ada] Fix thinko in Acc_Loop_to_gnu Message-ID: <20190819083858.GA33326@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes This fixes a glitch introduced during the initial OpenACC work import process, causing crashes on any Acc_Parallel + Acc_Loop combination. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-08-19 Olivier Hainque gcc/ada/ * gcc-interface/trans.c (Acc_Loop_to_gnu): Return the openacc BIND_EXPR node we have constructed on purpose. Remove unused variable. gcc/testsuite/ * gnat.dg/openacc1.adb: New testcase. --- gcc/ada/gcc-interface/trans.c +++ gcc/ada/gcc-interface/trans.c @@ -3398,9 +3398,6 @@ independent_iterations_p (tree stmt_list) static tree Acc_Loop_to_gnu (Node_Id gnat_loop) { - const struct loop_info_d * const gnu_loop_info = gnu_loop_stack->last (); - tree gnu_loop_stmt = gnu_loop_info->stmt; - tree acc_loop = make_node (OACC_LOOP); tree acc_bind_expr = NULL_TREE; Node_Id cur_loop = gnat_loop; @@ -3517,7 +3514,7 @@ Acc_Loop_to_gnu (Node_Id gnat_loop) BIND_EXPR_BODY (acc_bind_expr) = acc_loop; - return gnu_loop_stmt; + return acc_bind_expr; } /* Helper for Loop_Statement_to_gnu, to translate the body of a loop not --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/openacc1.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } + +procedure OpenAcc1 is + type Integer_Array is array (1 .. 32) of Integer; + Data : Integer_Array; +begin + for i in Data'Range loop + pragma Acc_Parallel; + pragma Acc_Loop(Worker); + Data (i) := i; + end loop; +end;