LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Link Mauve <linkmauve@linkmauve.fr>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: "Link Mauve" <linkmauve@linkmauve.fr>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	techflashYT <officialTechflashYT@gmail.com>,
	"Ash Logan" <ash@heyquark.com>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>
Subject: Re: [PATCH 2/2] powerpc/sstep: Don’t define variables we won’t be using
Date: Thu, 30 Jul 2026 08:39:13 +0200	[thread overview]
Message-ID: <amrxka_ZBaclQtZL@desktop> (raw)
In-Reply-To: <c48b748a-67d9-4fd4-b516-c54d2cf70704@kernel.org>

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


  reply	other threads:[~2026-07-30  6:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amrxka_ZBaclQtZL@desktop \
    --to=linkmauve@linkmauve.fr \
    --cc=ash@heyquark.com \
    --cc=chleroy@kernel.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=officialTechflashYT@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox