From 04d933fd48d7e7cbedb761d660229cac9f36fab2 Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Mon, 19 Aug 2019 08:35:24 +0000 Subject: [PATCH] [Ada] Fix thinko in Acc_Loop_to_gnu This fixes a glitch introduced during the initial OpenACC work import process, causing crashes on any Acc_Parallel + Acc_Loop combination. 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. From-SVN: r274638 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/trans.c | 5 +---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/openacc1.adb | 12 ++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/openacc1.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d6367e18c71..0ead3078297 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-19 Olivier Hainque + + * gcc-interface/trans.c (Acc_Loop_to_gnu): Return the openacc + BIND_EXPR node we have constructed on purpose. Remove unused + variable. + 2019-08-19 Pierre-Marie de Rodat * gcc-interface/lang.opt (fdump-scos): Define. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 95991bde274..6c696b9fdee 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96f259e5688..b68ff86979d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-08-19 Olivier Hainque + + * gnat.dg/openacc1.adb: New testcase. + 2019-08-19 Kito Cheng PR target/91441 diff --git a/gcc/testsuite/gnat.dg/openacc1.adb b/gcc/testsuite/gnat.dg/openacc1.adb new file mode 100644 index 00000000000..ce27a5f4824 --- /dev/null +++ b/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; -- 2.30.2