Hi!

On 2019-12-17T22:04:54-0800, Julian Brown <jul...@codesourcery.com> wrote:
> This part adds C and C++ execution tests to libgomp.

Spotted the following while looking into/for something else:

> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
> @@ -0,0 +1,45 @@

> +struct dc
> +{
> +  int a;
> +  int *b;
> +};

> +  v.b = (int *) malloc (sizeof (int) * n);

> +      assert (!acc_is_present (v.b, sizeof (int *) * n));

> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c

> +struct dc
> +{
> +  int a;
> +  int *b;
> +  int *c;
> +  int *d;
> +};

> +  v.b = (int *) malloc (sizeof (int) * n);
> +  v.c = (int *) malloc (sizeof (int) * n);
> +  v.d = (int *) malloc (sizeof (int) * n);

> +      assert (!acc_is_present (v.b, sizeof (int *) * n));
> +      assert (!acc_is_present (v.c, sizeof (int *) * n));
> +      assert (!acc_is_present (v.d, sizeof (int *) * n));

Note 'sizeof (int)' vs. 'sizeof (int *)' -- meaning that these asserts
were dead code, effectively.  ;-) I'd personally always use 'sizeof *v.b'
etc., avoiding these kinds of mismatches.  Here, maintaining the existing
style, I've changed the 'sizeof (int *)' into 'sizeof (int)', and pushed
"Fix 'sizeof' usage in 'libgomp.oacc-c-c++-common/deep-copy-{7,8}.c'" to
master branch in commit db7179ec74dda8c92db18399e5041a96ece8d56d, and
releases/gcc-10 branch in commit
62eeb36773d37fbfda9183ce50b724f834a875f2, see attached.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
>From db7179ec74dda8c92db18399e5041a96ece8d56d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Tue, 19 May 2020 22:35:15 +0200
Subject: [PATCH] Fix 'sizeof' usage in
 'libgomp.oacc-c-c++-common/deep-copy-{7,8}.c'

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: Fix 'sizeof'
	usage.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Likewise.
---
 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c | 2 +-
 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
index a59047af520d..13e5ca2e056c 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
@@ -38,7 +38,7 @@ main ()
 	assert (v.b[i] == v.a + i);
 
       assert (!acc_is_present (&v, sizeof (v)));
-      assert (!acc_is_present (v.b, sizeof (int *) * n));
+      assert (!acc_is_present (v.b, sizeof (int) * n));
     }
 
   return 0;
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
index 0ca5990b377b..1b4cf2fb6846 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
@@ -41,9 +41,9 @@ main ()
 	assert (v.b[i] == v.a + i);
 
       assert (acc_is_present (&v, sizeof (v)));
-      assert (!acc_is_present (v.b, sizeof (int *) * n));
-      assert (!acc_is_present (v.c, sizeof (int *) * n));
-      assert (!acc_is_present (v.d, sizeof (int *) * n));
+      assert (!acc_is_present (v.b, sizeof (int) * n));
+      assert (!acc_is_present (v.c, sizeof (int) * n));
+      assert (!acc_is_present (v.d, sizeof (int) * n));
     }
 
 #pragma acc exit data copyout(v)
-- 
2.26.2

>From 62eeb36773d37fbfda9183ce50b724f834a875f2 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Tue, 19 May 2020 22:35:15 +0200
Subject: [PATCH] Fix 'sizeof' usage in
 'libgomp.oacc-c-c++-common/deep-copy-{7,8}.c'

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: Fix 'sizeof'
	usage.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Likewise.

(cherry picked from commit db7179ec74dda8c92db18399e5041a96ece8d56d)
---
 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c | 2 +-
 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
index a59047af520d..13e5ca2e056c 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
@@ -38,7 +38,7 @@ main ()
 	assert (v.b[i] == v.a + i);
 
       assert (!acc_is_present (&v, sizeof (v)));
-      assert (!acc_is_present (v.b, sizeof (int *) * n));
+      assert (!acc_is_present (v.b, sizeof (int) * n));
     }
 
   return 0;
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
index 0ca5990b377b..1b4cf2fb6846 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
@@ -41,9 +41,9 @@ main ()
 	assert (v.b[i] == v.a + i);
 
       assert (acc_is_present (&v, sizeof (v)));
-      assert (!acc_is_present (v.b, sizeof (int *) * n));
-      assert (!acc_is_present (v.c, sizeof (int *) * n));
-      assert (!acc_is_present (v.d, sizeof (int *) * n));
+      assert (!acc_is_present (v.b, sizeof (int) * n));
+      assert (!acc_is_present (v.c, sizeof (int) * n));
+      assert (!acc_is_present (v.d, sizeof (int) * n));
     }
 
 #pragma acc exit data copyout(v)
-- 
2.26.2

Reply via email to