mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! commands: ubsan: hide zero division in test
@ 2025-03-19 16:10 Ahmad Fatoum
  2025-03-20 12:52 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-03-19 16:10 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

GCC complains that we pass the address of the variable instead of the
    variable itself:

    commands/ubsan.c: In function ‘test_ubsan_divrem_overflow’:
    error: lvalue required in ‘asm’ statement

       63 |         __asm__ ("" : "=r" (var) : "0" (var))
          |         ^~~~~~~
    ./commands/ubsan.c:46:9: note: in expansion of macro ‘OPTIMIZER_HIDE_VAR’
       46 |         OPTIMIZER_HIDE_VAR(&val2);

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/ubsan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/ubsan.c b/commands/ubsan.c
index 634ab2bc60b2..debd5e2ce7de 100644
--- a/commands/ubsan.c
+++ b/commands/ubsan.c
@@ -43,7 +43,7 @@ static void test_ubsan_divrem_overflow(void)
 	volatile int val = 16;
 	volatile int val2 = 0;
 
-	OPTIMIZER_HIDE_VAR(&val2);
+	OPTIMIZER_HIDE_VAR(val2);
 
 	val /= val2;
 }
-- 
2.39.5




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

* Re: [PATCH] fixup! commands: ubsan: hide zero division in test
  2025-03-19 16:10 [PATCH] fixup! commands: ubsan: hide zero division in test Ahmad Fatoum
@ 2025-03-20 12:52 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-03-20 12:52 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Wed, 19 Mar 2025 17:10:56 +0100, Ahmad Fatoum wrote:
> GCC complains that we pass the address of the variable instead of the
>     variable itself:
> 
>     commands/ubsan.c: In function ‘test_ubsan_divrem_overflow’:
>     error: lvalue required in ‘asm’ statement
> 
>        63 |         __asm__ ("" : "=r" (var) : "0" (var))
>           |         ^~~~~~~
>     ./commands/ubsan.c:46:9: note: in expansion of macro ‘OPTIMIZER_HIDE_VAR’
>        46 |         OPTIMIZER_HIDE_VAR(&val2);
> 
> [...]

Applied, thanks!

[1/1] fixup! commands: ubsan: hide zero division in test
      https://git.pengutronix.de/cgit/barebox/commit/?id=85749615acdd (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2025-03-20 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-19 16:10 [PATCH] fixup! commands: ubsan: hide zero division in test Ahmad Fatoum
2025-03-20 12:52 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox