All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC
@ 2026-07-29 20:49 Link Mauve
  2026-07-29 20:49 ` [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width Link Mauve
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Link Mauve @ 2026-07-29 20:49 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel
  Cc: Link Mauve, Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP)

Two local variables were only set but never read on 32-bit PowerPC,
which causes an error during compilation.

This series first makes the 64-bit guards consistent by converting all
uses of CONFIG_PPC64 to use __powerpc64__ instead, and then guard the
two variables rc and suffix behind __powerpc64__ checks.

Link Mauve (2):
  powerpc/sstep: Consistently use one define to check arch bit width
  powerpc/sstep: Don’t define variables we won’t be using

 arch/powerpc/lib/sstep.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)


base-commit: 78bc8af4affb9a732504eb22eeac7d1e50883853
-- 
2.55.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width
  2026-07-29 20:49 [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Link Mauve
@ 2026-07-29 20:49 ` Link Mauve
  2026-07-30  6:02   ` LEROY Christophe
  2026-07-29 20:49 ` [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using Link Mauve
  2026-07-30  5:51 ` [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Christophe Leroy (CS GROUP)
  2 siblings, 1 reply; 8+ messages in thread
From: Link Mauve @ 2026-07-29 20:49 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel
  Cc: Link Mauve, Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP)

Previously, both CONFIG_PPC64 and __powerpc64__ were being used to check
whether we were on 32-bit or on 64-bit PowerPC, sometimes in a single
function.

I picked __powerpc64__ since it was used six times as much as
CONFIG_PPC64 in this file, but could be convinced to use the other one
if there is any reason to prefer it.

Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
---
 arch/powerpc/lib/sstep.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index f0d6aa657c1a..597a0d841fe8 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -15,7 +15,7 @@
 #include <asm/cputable.h>
 #include <asm/disassemble.h>
 
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 /* Bits in SRR1 that are copied from MSR */
 #define MSR_MASK	0xffffffff87c0ffffUL
 #else
@@ -1256,7 +1256,7 @@ static nokprobe_inline void do_popcnt(const struct pt_regs *regs,
 	op->val = out;	/* popcntd */
 }
 
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 static nokprobe_inline void do_bpermd(const struct pt_regs *regs,
 				      struct instruction_op *op,
 				      unsigned long v1, unsigned long v2)
@@ -1273,7 +1273,7 @@ static nokprobe_inline void do_bpermd(const struct pt_regs *regs,
 	}
 	op->val = perm;
 }
-#endif /* CONFIG_PPC64 */
+#endif /* __powerpc64__ */
 /*
  * The size parameter adjusts the equivalent prty instruction.
  * prtyw = 32, prtyd = 64
@@ -1340,7 +1340,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)
 int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 		  ppc_inst_t instr)
 {
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 	unsigned int suffixopcode, prefixtype, prefix_r;
 #endif
 	unsigned int opcode, ra, rb, rc, rd, spr, u;
@@ -1739,7 +1739,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 			op->reg = rd;
 			op->val = 0xffffffff & ~(MSR_ME | MSR_LE);
 			return 0;
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 		case 178:	/* mtmsrd */
 			if (user_mode(regs))
 				goto priv;
@@ -2054,7 +2054,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 		case 186:	/* prtyd */
 			do_prty(regs, op, regs->gpr[rd], 64);
 			goto logical_done_nocc;
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 		case 252:	/* bpermd */
 			do_bpermd(regs, op, regs->gpr[rd], regs->gpr[rb]);
 			goto logical_done_nocc;
@@ -2082,7 +2082,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 		case 476:	/* nand */
 			op->val = ~(regs->gpr[rd] & regs->gpr[rb]);
 			goto logical_done;
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 		case 506:	/* popcntd */
 			do_popcnt(regs, op, regs->gpr[rd], 64);
 			goto logical_done_nocc;
@@ -3247,7 +3247,7 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op)
 		case BARRIER_EIEIO:
 			eieio();
 			break;
-#ifdef CONFIG_PPC64
+#ifdef __powerpc64__
 		case BARRIER_LWSYNC:
 			asm volatile("lwsync" : : : "memory");
 			break;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using
  2026-07-29 20:49 [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Link Mauve
  2026-07-29 20:49 ` [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width Link Mauve
@ 2026-07-29 20:49 ` Link Mauve
  2026-07-30  6:24   ` Christophe Leroy (CS GROUP)
  2026-07-30  5:51 ` [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Christophe Leroy (CS GROUP)
  2 siblings, 1 reply; 8+ messages in thread
From: Link Mauve @ 2026-07-29 20:49 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel
  Cc: Link Mauve, Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP)

It seems this function has only compiled without warnings on PPC64, not
on PowerPC, so before this commit it would fail with:
```
../arch/powerpc/lib/sstep.c: In function 'analyse_instr':
../arch/powerpc/lib/sstep.c:1350:28: error: variable 'suffix' set but not used [-Werror=unused-but-set-variable]
 1350 |         unsigned int word, suffix;
      |                            ^~~~~~
../arch/powerpc/lib/sstep.c:1346:38: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
 1346 |         unsigned int opcode, ra, rb, rc, rd, spr, u;
      |                                      ^~
cc1: all warnings being treated as errors
```

Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
---
 arch/powerpc/lib/sstep.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 597a0d841fe8..c866e4337f94 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1342,16 +1342,20 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 {
 #ifdef __powerpc64__
 	unsigned int suffixopcode, prefixtype, prefix_r;
+	unsigned int rc;
+	unsigned int suffix;
 #endif
-	unsigned int opcode, ra, rb, rc, rd, spr, u;
+	unsigned int opcode, ra, rb, rd, spr, u;
 	unsigned long int imm;
 	unsigned long int val, val2;
 	unsigned int mb, me, sh;
-	unsigned int word, suffix;
+	unsigned int word;
 	long ival;
 
 	word = ppc_inst_val(instr);
+#ifdef __powerpc64__
 	suffix = ppc_inst_suffix(instr);
+#endif
 
 	op->type = COMPUTE;
 
@@ -1469,7 +1473,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 	rd = (word >> 21) & 0x1f;
 	ra = (word >> 16) & 0x1f;
 	rb = (word >> 11) & 0x1f;
+#ifdef __powerpc64__
 	rc = (word >> 6) & 0x1f;
+#endif
 
 	switch (opcode) {
 #ifdef __powerpc64__
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC
  2026-07-29 20:49 [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Link Mauve
  2026-07-29 20:49 ` [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width Link Mauve
  2026-07-29 20:49 ` [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using Link Mauve
@ 2026-07-30  5:51 ` Christophe Leroy (CS GROUP)
  2026-07-30  6:04   ` Link Mauve
  2 siblings, 1 reply; 8+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-07-30  5:51 UTC (permalink / raw)
  To: Link Mauve, linuxppc-dev, linux-kernel
  Cc: Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin



Le 29/07/2026 à 22:49, Link Mauve a écrit :
> Two local variables were only set but never read on 32-bit PowerPC,
> which causes an error during compilation.

Are those errors new ? This series and the one from yesterday on ppc64, 
I have the feeling that the code is not new. Has anything changed in the 
building flags or does this pops up with recent versions of GCC ? If it 
is the case it is worth saying it in the commit messages in order to 
clarify the reason for the fix.

> 
> This series first makes the 64-bit guards consistent by converting all
> uses of CONFIG_PPC64 to use __powerpc64__ instead, and then guard the
> two variables rc and suffix behind __powerpc64__ checks.
> 
> Link Mauve (2):
>    powerpc/sstep: Consistently use one define to check arch bit width
>    powerpc/sstep: Don’t define variables we won’t be using
> 
>   arch/powerpc/lib/sstep.c | 26 ++++++++++++++++----------
>   1 file changed, 16 insertions(+), 10 deletions(-)
> 
> 
> base-commit: 78bc8af4affb9a732504eb22eeac7d1e50883853



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width
  2026-07-29 20:49 ` [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width Link Mauve
@ 2026-07-30  6:02   ` LEROY Christophe
  0 siblings, 0 replies; 8+ messages in thread
From: LEROY Christophe @ 2026-07-30  6:02 UTC (permalink / raw)
  To: Link Mauve, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
  Cc: Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin



Le 29/07/2026 à 22:49, Link Mauve a écrit :
> Previously, both CONFIG_PPC64 and __powerpc64__ were being used to check
> whether we were on 32-bit or on 64-bit PowerPC, sometimes in a single
> function.
> 
> I picked __powerpc64__ since it was used six times as much as
> CONFIG_PPC64 in this file, but could be convinced to use the other one
> if there is any reason to prefer it.

Well, we tend to use the other as much as possible:

$ git grep -w -e "#ifdef CONFIG_PPC64" -e "defined(CONFIG_PPC64)" | wc -l
368
$ git grep -w -e "#ifdef __powerpc64__"  | wc -l
118

Allthough in most cases you can use one or the other, they don't mean 
the same.

CONFIG_PPC64 means you are building a 64 bit kernel.
__powerpc64__ means you are building 64 bit code.

In a 64 bit kernel you can have 32 bit code, for instance the vdso32.

If you look into include/asm/feature-fixups.h for instance you have :

#if defined(CONFIG_PPC64) && !defined(__powerpc64__)
/* 64 bits kernel, 32 bits code (ie. vdso32) */
#define FTR_ENTRY_LONG		.8byte
#define FTR_ENTRY_OFFSET	.long 0xffffffff; .long
#elif defined(CONFIG_PPC64)
#define FTR_ENTRY_LONG		.8byte
#define FTR_ENTRY_OFFSET	.8byte
#else
#define FTR_ENTRY_LONG		.long
#define FTR_ENTRY_OFFSET	.long
#endif

Unless you are a good reason to use __powerpc64__ it is often better to 
use CONFIG_PPC64

Christophe

> 
> Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
> ---
>   arch/powerpc/lib/sstep.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
> index f0d6aa657c1a..597a0d841fe8 100644
> --- a/arch/powerpc/lib/sstep.c
> +++ b/arch/powerpc/lib/sstep.c
> @@ -15,7 +15,7 @@
>   #include <asm/cputable.h>
>   #include <asm/disassemble.h>
>   
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   /* Bits in SRR1 that are copied from MSR */
>   #define MSR_MASK	0xffffffff87c0ffffUL
>   #else
> @@ -1256,7 +1256,7 @@ static nokprobe_inline void do_popcnt(const struct pt_regs *regs,
>   	op->val = out;	/* popcntd */
>   }
>   
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   static nokprobe_inline void do_bpermd(const struct pt_regs *regs,
>   				      struct instruction_op *op,
>   				      unsigned long v1, unsigned long v2)
> @@ -1273,7 +1273,7 @@ static nokprobe_inline void do_bpermd(const struct pt_regs *regs,
>   	}
>   	op->val = perm;
>   }
> -#endif /* CONFIG_PPC64 */
> +#endif /* __powerpc64__ */
>   /*
>    * The size parameter adjusts the equivalent prty instruction.
>    * prtyw = 32, prtyd = 64
> @@ -1340,7 +1340,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)
>   int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   		  ppc_inst_t instr)
>   {
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   	unsigned int suffixopcode, prefixtype, prefix_r;
>   #endif
>   	unsigned int opcode, ra, rb, rc, rd, spr, u;
> @@ -1739,7 +1739,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   			op->reg = rd;
>   			op->val = 0xffffffff & ~(MSR_ME | MSR_LE);
>   			return 0;
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   		case 178:	/* mtmsrd */
>   			if (user_mode(regs))
>   				goto priv;
> @@ -2054,7 +2054,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   		case 186:	/* prtyd */
>   			do_prty(regs, op, regs->gpr[rd], 64);
>   			goto logical_done_nocc;
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   		case 252:	/* bpermd */
>   			do_bpermd(regs, op, regs->gpr[rd], regs->gpr[rb]);
>   			goto logical_done_nocc;
> @@ -2082,7 +2082,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   		case 476:	/* nand */
>   			op->val = ~(regs->gpr[rd] & regs->gpr[rb]);
>   			goto logical_done;
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   		case 506:	/* popcntd */
>   			do_popcnt(regs, op, regs->gpr[rd], 64);
>   			goto logical_done_nocc;
> @@ -3247,7 +3247,7 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op)
>   		case BARRIER_EIEIO:
>   			eieio();
>   			break;
> -#ifdef CONFIG_PPC64
> +#ifdef __powerpc64__
>   		case BARRIER_LWSYNC:
>   			asm volatile("lwsync" : : : "memory");
>   			break;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC
  2026-07-30  5:51 ` [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Christophe Leroy (CS GROUP)
@ 2026-07-30  6:04   ` Link Mauve
  0 siblings, 0 replies; 8+ messages in thread
From: Link Mauve @ 2026-07-30  6:04 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Link Mauve, linuxppc-dev, linux-kernel, Madhavan Srinivasan,
	techflashYT, Ash Logan, Jonathan Neuschäfer,
	Michael Ellerman, Nicholas Piggin

On Thu, Jul 30, 2026 at 07:51:40AM +0200, Christophe Leroy (CS GROUP) wrote:
> 
> 
> Le 29/07/2026 à 22:49, Link Mauve a écrit :
> > Two local variables were only set but never read on 32-bit PowerPC,
> > which causes an error during compilation.
> 
> Are those errors new ? This series and the one from yesterday on ppc64, I
> have the feeling that the code is not new. Has anything changed in the
> building flags or does this pops up with recent versions of GCC ? If it is
> the case it is worth saying it in the commit messages in order to clarify
> the reason for the fix.

I think they started happening when I enabled Rust support, but I’ve
been doing that for quite a while and I don’t know if the two are
linked, and when I disable CONFIG_RUST it’s still erroring without this
series.

I’m pretty sure someone has built the kernel on 32-bit PowerPC since
650b55b707fdfa764e9f2b81314d3eb4216fb962 or
930d6288a26787d2e7f633705434171a506db9c5, both commits introducing the
two variables which are then never used.

I couldn’t follow the maze of Makefile enough to determine where
-Werror=unused-but-set-variable is set, if this is specific to recent
versions of gcc or not, if this is enabled by a different CONFIG_
option, if this could be disabled already.  But I believe fixing this
issue is good anyway, the compiler is right that without __powerpc64__
these two variables are never used.

> 
> > 
> > This series first makes the 64-bit guards consistent by converting all
> > uses of CONFIG_PPC64 to use __powerpc64__ instead, and then guard the
> > two variables rc and suffix behind __powerpc64__ checks.
> > 
> > Link Mauve (2):
> >    powerpc/sstep: Consistently use one define to check arch bit width
> >    powerpc/sstep: Don’t define variables we won’t be using
> > 
> >   arch/powerpc/lib/sstep.c | 26 ++++++++++++++++----------
> >   1 file changed, 16 insertions(+), 10 deletions(-)
> > 
> > 
> > base-commit: 78bc8af4affb9a732504eb22eeac7d1e50883853
> 

-- 
Link Mauve


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using
  2026-07-29 20:49 ` [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using Link Mauve
@ 2026-07-30  6:24   ` Christophe Leroy (CS GROUP)
  2026-07-30  6:39     ` Link Mauve
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-07-30  6:24 UTC (permalink / raw)
  To: Link Mauve, linuxppc-dev, linux-kernel
  Cc: Madhavan Srinivasan, techflashYT, Ash Logan,
	Jonathan Neuschäfer, Michael Ellerman, Nicholas Piggin



Le 29/07/2026 à 22:49, Link Mauve a écrit :
> It seems this function has only compiled without warnings on PPC64, not
> on PowerPC, so before this commit it would fail with:
> ```
> ../arch/powerpc/lib/sstep.c: In function 'analyse_instr':
> ../arch/powerpc/lib/sstep.c:1350:28: error: variable 'suffix' set but not used [-Werror=unused-but-set-variable]
>   1350 |         unsigned int word, suffix;
>        |                            ^~~~~~
> ../arch/powerpc/lib/sstep.c:1346:38: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
>   1346 |         unsigned int opcode, ra, rb, rc, rd, spr, u;
>        |                                      ^~
> cc1: all warnings being treated as errors
> ```
> 

I'm surprised we still have this issue. I remember seeing it reported 
several times allthough I've not been able to spot when.

By the way on my side it happens only when I do a W=1 build.

Same as previous patch, I'd prefer using CONFIG_PPC64 instead of 
__powerpc64__

> Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
> ---
>   arch/powerpc/lib/sstep.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
> index 597a0d841fe8..c866e4337f94 100644
> --- a/arch/powerpc/lib/sstep.c
> +++ b/arch/powerpc/lib/sstep.c
> @@ -1342,16 +1342,20 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   {
>   #ifdef __powerpc64__
>   	unsigned int suffixopcode, prefixtype, prefix_r;
> +	unsigned int rc;
> +	unsigned int suffix;

A single line would be enough:

	unsigned int rc, suffix;

>   #endif
> -	unsigned int opcode, ra, rb, rc, rd, spr, u;
> +	unsigned int opcode, ra, rb, rd, spr, u;
>   	unsigned long int imm;
>   	unsigned long int val, val2;
>   	unsigned int mb, me, sh;
> -	unsigned int word, suffix;
> +	unsigned int word;
>   	long ival;
>   
>   	word = ppc_inst_val(instr);
> +#ifdef __powerpc64__
>   	suffix = ppc_inst_suffix(instr);
> +#endif
>   
>   	op->type = COMPUTE;
>   
> @@ -1469,7 +1473,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
>   	rd = (word >> 21) & 0x1f;
>   	ra = (word >> 16) & 0x1f;
>   	rb = (word >> 11) & 0x1f;
> +#ifdef __powerpc64__
>   	rc = (word >> 6) & 0x1f;
> +#endif
>   
>   	switch (opcode) {
>   #ifdef __powerpc64__


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using
  2026-07-30  6:24   ` Christophe Leroy (CS GROUP)
@ 2026-07-30  6:39     ` Link Mauve
  0 siblings, 0 replies; 8+ messages in thread
From: Link Mauve @ 2026-07-30  6:39 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Link Mauve, linuxppc-dev, linux-kernel, Madhavan Srinivasan,
	techflashYT, Ash Logan, Jonathan Neuschäfer,
	Michael Ellerman, Nicholas Piggin

On Thu, Jul 30, 2026 at 08:24:36AM +0200, Christophe Leroy (CS GROUP) wrote:
> 
> 
> Le 29/07/2026 à 22:49, Link Mauve a écrit :
> > It seems this function has only compiled without warnings on PPC64, not
> > on PowerPC, so before this commit it would fail with:
> > ```
> > ../arch/powerpc/lib/sstep.c: In function 'analyse_instr':
> > ../arch/powerpc/lib/sstep.c:1350:28: error: variable 'suffix' set but not used [-Werror=unused-but-set-variable]
> >   1350 |         unsigned int word, suffix;
> >        |                            ^~~~~~
> > ../arch/powerpc/lib/sstep.c:1346:38: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
> >   1346 |         unsigned int opcode, ra, rb, rc, rd, spr, u;
> >        |                                      ^~
> > cc1: all warnings being treated as errors
> > ```
> > 
> 
> I'm surprised we still have this issue. I remember seeing it reported
> several times allthough I've not been able to spot when.
> 
> By the way on my side it happens only when I do a W=1 build.

Oh indeed, I was using W=1 all along, thanks for spotting that!

> 
> Same as previous patch, I'd prefer using CONFIG_PPC64 instead of
> __powerpc64__

Will do in v2.

> 
> > Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
> > ---
> >   arch/powerpc/lib/sstep.c | 10 ++++++++--
> >   1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
> > index 597a0d841fe8..c866e4337f94 100644
> > --- a/arch/powerpc/lib/sstep.c
> > +++ b/arch/powerpc/lib/sstep.c
> > @@ -1342,16 +1342,20 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
> >   {
> >   #ifdef __powerpc64__
> >   	unsigned int suffixopcode, prefixtype, prefix_r;
> > +	unsigned int rc;
> > +	unsigned int suffix;
> 
> A single line would be enough:

Will do in v2.

> 
> 	unsigned int rc, suffix;
> 
> >   #endif
> > -	unsigned int opcode, ra, rb, rc, rd, spr, u;
> > +	unsigned int opcode, ra, rb, rd, spr, u;
> >   	unsigned long int imm;
> >   	unsigned long int val, val2;
> >   	unsigned int mb, me, sh;
> > -	unsigned int word, suffix;
> > +	unsigned int word;
> >   	long ival;
> >   	word = ppc_inst_val(instr);
> > +#ifdef __powerpc64__
> >   	suffix = ppc_inst_suffix(instr);
> > +#endif
> >   	op->type = COMPUTE;
> > @@ -1469,7 +1473,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
> >   	rd = (word >> 21) & 0x1f;
> >   	ra = (word >> 16) & 0x1f;
> >   	rb = (word >> 11) & 0x1f;
> > +#ifdef __powerpc64__
> >   	rc = (word >> 6) & 0x1f;
> > +#endif
> >   	switch (opcode) {
> >   #ifdef __powerpc64__
> 

-- 
Link Mauve


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-30  6:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 20:49 [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Link Mauve
2026-07-29 20:49 ` [PATCH 1/2] powerpc/sstep: Consistently use one define to check arch bit width Link Mauve
2026-07-30  6:02   ` LEROY Christophe
2026-07-29 20:49 ` [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using Link Mauve
2026-07-30  6:24   ` Christophe Leroy (CS GROUP)
2026-07-30  6:39     ` Link Mauve
2026-07-30  5:51 ` [PATCH 0/2] powerpc/sstep: Fix compilation on 32-bit PowerPC Christophe Leroy (CS GROUP)
2026-07-30  6:04   ` Link Mauve

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.