[Openmp-commits] [openmp] [OpenMP][Fix] Fix test array initialization. (PR #74799)

Gheorghe-Teodor Bercea via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 7 19:04:54 PST 2023


https://github.com/doru1004 updated https://github.com/llvm/llvm-project/pull/74799

>From bd63426b53da88890155ec76fd5197a974574938 Mon Sep 17 00:00:00 2001
From: Doru Bercea <doru.bercea at amd.com>
Date: Thu, 7 Dec 2023 21:44:07 -0500
Subject: [PATCH] Fix test array initialization.

---
 .../test/offloading/back2back_distribute.c           | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/openmp/libomptarget/test/offloading/back2back_distribute.c b/openmp/libomptarget/test/offloading/back2back_distribute.c
index 750e39061974a3..94925a72f94032 100644
--- a/openmp/libomptarget/test/offloading/back2back_distribute.c
+++ b/openmp/libomptarget/test/offloading/back2back_distribute.c
@@ -15,12 +15,12 @@ void reset_input(double *a, double *a_h, double *b, double *c) {
 }
 
 int main(int argc, char *argv[]) {
-  double * a = (double *) malloc(MAX_N * sizeof(double));
-  double * a_h = (double *) malloc(MAX_N * sizeof(double));
-  double * d = (double *) malloc(MAX_N * sizeof(double));
-  double * d_h = (double *) malloc(MAX_N * sizeof(double));
-  double * b = (double *) malloc(MAX_N * sizeof(double));
-  double * c = (double *) malloc(MAX_N * sizeof(double));
+  double * a = (double *) calloc(MAX_N * sizeof(double));
+  double * a_h = (double *) calloc(MAX_N * sizeof(double));
+  double * d = (double *) calloc(MAX_N * sizeof(double));
+  double * d_h = (double *) calloc(MAX_N * sizeof(double));
+  double * b = (double *) calloc(MAX_N * sizeof(double));
+  double * c = (double *) calloc(MAX_N * sizeof(double));
 
 #pragma omp target enter data map(to:a[:MAX_N],b[:MAX_N],c[:MAX_N],d[:MAX_N])
 



More information about the Openmp-commits mailing list