On Thu, Dec 12, 2024 at 06:05:31PM +0100, Andreas Schwab wrote:
> Don't use 'c' modifier with a symbolic address.  The riscv target doesn't
> accept it as a CONSTANT_ADDRESS_P and doesn't support 'c' with SYMBOL_REF.
> 
>       * c-c++-common/toplevel-asm-1.c: Remove 'c' from %3 and %4.

The intent was to test %cN because %N doesn't DTRT on various targets.
I have a patch to add %ccN support which should then work even on riscv
hopefully, but unfortunately it hasn't been fully reviewed yet.

If you want a workaround before that, I'd suggest doing it conditionally
for arches which don't handle %cN with SYMBOL_REFs even with -fno-pie, so
that we do test %cN on those where it does work.

> --- a/gcc/testsuite/c-c++-common/toplevel-asm-1.c
> +++ b/gcc/testsuite/c-c++-common/toplevel-asm-1.c
> @@ -8,7 +8,7 @@ enum E { E0, E1 = sizeof (struct S) + 15 };
>  int v[42];
>  void foo (void) {}
>  
> -asm ("# %0 %1 %2 %c3 %c4 %5 %% %="
> +asm ("# %0 %1 %2 %3 %4 %5 %% %="
>       :: "i" (sizeof (struct S)),
>       "i" (__builtin_offsetof (struct S, c)),
>       "i" (E1),
> -- 
> 2.47.1

        Jakub

Reply via email to