Skip to contentSkip to conversation

memorder: Silence compiler warnings in litmus tests

PATCH In review Akira Yokosawa 2 participants 4 messages Sep 4, 2017 – Sep 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memorder: Silence compiler warnings in litmus tests

From 410b1edcf1255563371b9b9bc8b54f10b3125090 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 4 Sep 2017 23:35:06 +0900
Subject: [PATCH] memorder: Silence compiler warnings in litmus tests

Silence warnings from gcc:

    C-MP+o-r+o-ctrl-o.c:
        warning: 'r3' may be used uninitialized in this function
        [-Wmaybe-uninitialized]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: assignment makes pointer from integer without a cast
        [-Wint-conversion]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: cast from pointer to integer of different size
        [-Wpointer-to-int-cast]
---
 CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus         |  2 +-
 CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus |  6 +++---
 CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus    |  6 +++---
 memorder/memorder.tex                                     | 14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)
CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus +1 -1
index fe44072..82cf629 100644
@@ -16,7 +16,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
 	int r2;
-	int r3;
+	int r3 = 0;
 
 	r2 = READ_ONCE(*x1);
 	if (r2 >= 0)
CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus +3 -3
index 1e0f1b7..23050e6 100644
@@ -19,8 +19,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -28,7 +28,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus +3 -3
index a71f1ac..527b373 100644
@@ -18,8 +18,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -27,7 +27,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
memorder/memorder.tex +7 -7
index 624f9a8..151af4e 100644
@@ -1567,7 +1567,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
   int r2;
-  int r3;
+  int r3 = 0;
 
   r2 = READ_ONCE(*x1);
   if (r2 >= 0)
@@ -2162,8 +2162,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2171,7 +2171,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
@@ -2258,8 +2258,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2267,7 +2267,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · Akira Yokosawa
Quoted 1 line

From 410b1edcf1255563371b9b9bc8b54f10b3125090 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 4 Sep 2017 23:35:06 +0900
Subject: [PATCH] memorder: Silence compiler warnings in litmus tests

Silence warnings from gcc:

    C-MP+o-r+o-ctrl-o.c:
        warning: 'r3' may be used uninitialized in this function
        [-Wmaybe-uninitialized]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: assignment makes pointer from integer without a cast
        [-Wint-conversion]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: cast from pointer to integer of different size
        [-Wpointer-to-int-cast]
Quoted 1 line

Good catches, fixed, thank you!

I am clearly going to have train myself to scroll up beyond the final-state histogram, aren't I?

Thanx, Paul

Quoted 124 lines
---
 CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus         |  2 +-
 CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus |  6 +++---
 CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus    |  6 +++---
 memorder/memorder.tex                                     | 14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)
CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus +1 -1
index fe44072..82cf629 100644
@@ -16,7 +16,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
 	int r2;
-	int r3;
+	int r3 = 0;
 
 	r2 = READ_ONCE(*x1);
 	if (r2 >= 0)
CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus +3 -3
index 1e0f1b7..23050e6 100644
@@ -19,8 +19,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -28,7 +28,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus +3 -3
index a71f1ac..527b373 100644
@@ -18,8 +18,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -27,7 +27,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
memorder/memorder.tex +7 -7
index 624f9a8..151af4e 100644
@@ -1567,7 +1567,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
   int r2;
-  int r3;
+  int r3 = 0;
 
   r2 = READ_ONCE(*x1);
   if (r2 >= 0)
@@ -2162,8 +2162,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2171,7 +2171,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
@@ -2258,8 +2258,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2267,7 +2267,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
Signature · 1 line
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to [email protected]
More majordomo info at https://urldefense.proofpoint.com/v2/url?u=http-3A__vger.kernel.org_majordomo-2Dinfo.html&d=DwIBAg&c=jf_iaSHvJObTbx-siA1ZOg&r=ux41CW3B5BSVxDMRNRWyLbUmPebZc70Kq4AkfdiRGMI&m=buSAKCmyVChRbvIbC5pqfrs3MK6aPbJv2midOUInLkY&s=S8ysDKR7FYGRxmPSL7QpBhmGXmJeIFCz8LL7uOlscv0&e=

#2 lore raw
Quoted 18 lines · Paul E. McKenney
Quoted 17 lines · Akira Yokosawa
Quoted 1 line

From 410b1edcf1255563371b9b9bc8b54f10b3125090 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 4 Sep 2017 23:35:06 +0900
Subject: [PATCH] memorder: Silence compiler warnings in litmus tests

Silence warnings from gcc:

    C-MP+o-r+o-ctrl-o.c:
        warning: 'r3' may be used uninitialized in this function
        [-Wmaybe-uninitialized]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: assignment makes pointer from integer without a cast
        [-Wint-conversion]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: cast from pointer to integer of different size
        [-Wpointer-to-int-cast]
Quoted 6 lines
Quoted 1 line

Good catches, fixed, thank you!

I am clearly going to have train myself to scroll up beyond the final-state histogram, aren't I?

;-)

I noticed these warnings when I cross compiled on PPC. You can see warnings (without executing) on x86 by:

    $ make cross-x86
    $ cd X86
    $ sh comp.sh

Thanks, Akira

Quoted 129 lines

Thanx, Paul

Quoted 124 lines
---
 CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus         |  2 +-
 CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus |  6 +++---
 CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus    |  6 +++---
 memorder/memorder.tex                                     | 14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)
CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus +1 -1
index fe44072..82cf629 100644
@@ -16,7 +16,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
 	int r2;
-	int r3;
+	int r3 = 0;
 
 	r2 = READ_ONCE(*x1);
 	if (r2 >= 0)
CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus +3 -3
index 1e0f1b7..23050e6 100644
@@ -19,8 +19,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -28,7 +28,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus +3 -3
index a71f1ac..527b373 100644
@@ -18,8 +18,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -27,7 +27,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
memorder/memorder.tex +7 -7
index 624f9a8..151af4e 100644
@@ -1567,7 +1567,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
   int r2;
-  int r3;
+  int r3 = 0;
 
   r2 = READ_ONCE(*x1);
   if (r2 >= 0)
@@ -2162,8 +2162,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2171,7 +2171,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
@@ -2258,8 +2258,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2267,7 +2267,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
Signature · 1 line
2.7.4
#3 lore raw
Quoted 26 lines · Akira Yokosawa
Quoted 18 lines · Paul E. McKenney
Quoted 17 lines · Akira Yokosawa
Quoted 1 line

From 410b1edcf1255563371b9b9bc8b54f10b3125090 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 4 Sep 2017 23:35:06 +0900
Subject: [PATCH] memorder: Silence compiler warnings in litmus tests

Silence warnings from gcc:

    C-MP+o-r+o-ctrl-o.c:
        warning: 'r3' may be used uninitialized in this function
        [-Wmaybe-uninitialized]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: assignment makes pointer from integer without a cast
        [-Wint-conversion]
    C-W+RWC+o-mb-o+a-o+o-mb-o.c, C-W+RWC+o-r+a-o+o-mb-o.c:
        warning: cast from pointer to integer of different size
        [-Wpointer-to-int-cast]
Quoted 6 lines
Quoted 1 line

Good catches, fixed, thank you!

I am clearly going to have train myself to scroll up beyond the final-state histogram, aren't I?

Quoted 8 lines

;-)

I noticed these warnings when I cross compiled on PPC. You can see warnings (without executing) on x86 by:

    $ make cross-x86
    $ cd X86
    $ sh comp.sh

Thank you for the tip!

Thanx, Paul

Quoted 132 lines

Thanks, Akira

Quoted 129 lines

Thanx, Paul

Quoted 124 lines
---
 CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus         |  2 +-
 CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus |  6 +++---
 CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus    |  6 +++---
 memorder/memorder.tex                                     | 14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)
CodeSamples/advsync/herd/C-MP+o-r+o-ctrl-o.litmus +1 -1
index fe44072..82cf629 100644
@@ -16,7 +16,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
 	int r2;
-	int r3;
+	int r3 = 0;
 
 	r2 = READ_ONCE(*x1);
 	if (r2 >= 0)
CodeSamples/advsync/herd/C-W+RWC+o-mb-o+a-o+o-mb-o.litmus +3 -3
index 1e0f1b7..23050e6 100644
@@ -19,8 +19,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -28,7 +28,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
CodeSamples/advsync/herd/C-W+RWC+o-r+a-o+o-mb-o.litmus +3 -3
index a71f1ac..527b373 100644
@@ -18,8 +18,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-	int *r1;
-	int *r2;
+	int r1;
+	int r2;
 
 	r1 = smp_load_acquire(y);
 	r2 = READ_ONCE(*z);
@@ -27,7 +27,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-	int *r3;
+	int r3;
 
 	WRITE_ONCE(*z, 1);
 	smp_mb();
memorder/memorder.tex +7 -7
index 624f9a8..151af4e 100644
@@ -1567,7 +1567,7 @@ P0(int* x0, int* x1) {
 
 P1(int* x0, int* x1) {
   int r2;
-  int r3;
+  int r3 = 0;
 
   r2 = READ_ONCE(*x1);
   if (r2 >= 0)
@@ -2162,8 +2162,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2171,7 +2171,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
@@ -2258,8 +2258,8 @@ P0(int *x, int *y)
 
 P1(int *y, int *z)
 {
-  int *r1;
-  int *r2;
+  int r1;
+  int r2;
 
   r1 = smp_load_acquire(y);
   r2 = READ_ONCE(*z);
@@ -2267,7 +2267,7 @@ P1(int *y, int *z)
 
 P2(int *z, int *x)
 {
-  int *r3;
+  int r3;
 
   WRITE_ONCE(*z, 1);
   smp_mb();
Signature · 1 line
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to [email protected]
More majordomo info at https://urldefense.proofpoint.com/v2/url?u=http-3A__vger.kernel.org_majordomo-2Dinfo.html&d=DwIBAg&c=jf_iaSHvJObTbx-siA1ZOg&r=ux41CW3B5BSVxDMRNRWyLbUmPebZc70Kq4AkfdiRGMI&m=Sb2C9OumgkzFn7qaI1vmWXpq6IB4zDco7fktabJ8L3Y&s=9fILY_K6te9XCcykZKVQjBge4js8zXr8iL7mMkBy7EY&e=