public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] m68k: libgcc: Fix lvalue abuse in umul_ppmm()
Date: Thu, 9 Jan 2025 09:03:09 +1000	[thread overview]
Message-ID: <c59ce4ca-0647-45d1-ae83-9644f1fefd27@linux-m68k.org> (raw)
In-Reply-To: <c408cfb85bfde8929dcaa4ebea29ade4e1452d8e.1736356696.git.geert@linux-m68k.org>

Hi Geert,

On 9/1/25 03:22, Geert Uytterhoeven wrote:
>      lib/muldi3.c:53:28: warning: asm output is not an lvalue
>      lib/muldi3.c:53:28: warning: asm output is not an lvalue
>      lib/muldi3.c:53:28: error: not addressable
>      lib/muldi3.c:53:28: warning: generating address of non-lvalue (11)
>      lib/muldi3.c:53:28: warning: generating address of non-lvalue (11)
> 
> Fix the lvalue warnings by replacing the casts on the output operands by
> intermediate variables of the right type.
> 
> Fix the "not addressable" error by replacing the cast on the second
> input operand by an intermediate variable, too.  Treat the other input
> operand the same for consistency.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501030516.uZrwnuQQ-lkp@intel.com/
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Thanks for cleaning this up.

Acked-by: Greg Ungerer <gerg@linux-m68k.org>

Regards
Greg



> ---
> To be queued in the m68k for-v6.14 branch.
> Not folding into commit e96424b86d5098f4 ("m68k: Use kernel's generic
> muldi3 libgcc function"), as the issue was pre-existing.
> ---
>   arch/m68k/include/asm/libgcc.h | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/m68k/include/asm/libgcc.h b/arch/m68k/include/asm/libgcc.h
> index 1cce6d130d805368..27e17195bd7be41c 100644
> --- a/arch/m68k/include/asm/libgcc.h
> +++ b/arch/m68k/include/asm/libgcc.h
> @@ -10,11 +10,18 @@
>    * will fallback to using the C-coded version of umul_ppmm().
>    */
>   #define umul_ppmm(w1, w0, u, v)				\
> -	__asm__ ("mulu%.l %3,%1:%0"			\
> -		 : "=d" ((unsigned long)(w0)),		\
> -		   "=d" ((unsigned long)(w1))		\
> -		 : "%0" ((unsigned long)(u)),		\
> -		   "dmi" ((unsigned long)(v)))
> +	do {						\
> +		unsigned long __u = (u), __v = (v);	\
> +		unsigned long __w0, __w1;		\
> +							\
> +		__asm__ ("mulu%.l %3,%1:%0"		\
> +			 : "=d" (__w0),			\
> +			   "=d" (__w1)			\
> +			 : "%0" (__u),			\
> +			   "dmi" (__v));		\
> +							\
> +		(w0) = __w0; (w1) = __w1;		\
> +	} while (0)
>   #endif /* !CONFIG_CPU_HAS_NO_MULDIV64 */
>   
>   #endif /* __ASM_M68K_LIBGCC_H */


      reply	other threads:[~2025-01-08 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 17:22 [PATCH] m68k: libgcc: Fix lvalue abuse in umul_ppmm() Geert Uytterhoeven
2025-01-08 23:03 ` Greg Ungerer [this message]

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=c59ce4ca-0647-45d1-ae83-9644f1fefd27@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=arnd@arndb.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=lkp@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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