https://gcc.gnu.org/g:b117201385d3e8b0ee3fca396b77b2539f90bd40

commit r15-6364-gb117201385d3e8b0ee3fca396b77b2539f90bd40
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Dec 19 11:36:29 2024 +0100

    testsuite: Fix toplevel-asm-1.c failure for riscv
    
    On Wed, Dec 18, 2024 at 01:19:43PM +0100, Andreas Schwab wrote:
    > On Dez 12 2024, Jakub Jelinek wrote:
    >
    > > 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.
    >
    > That didn't change toplevel-asm-1, so the failure remains.
    
    Yes, I've only committed what was approved.
    
    The following patch ought to fix this (and if there are other targets which
    don't really support %cN for SYMBOL_REFs even with -fno-pic, they can be
    added there too; I think it is useful to test %cN on the targets where it
    works though).
    
    2024-12-19  Jakub Jelinek  <ja...@redhat.com>
    
            * c-c++-common/toplevel-asm-1.c: Use %cc3 %cc4 instead of %c3 %c4
            on riscv.

Diff:
---
 gcc/testsuite/c-c++-common/toplevel-asm-1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/toplevel-asm-1.c 
b/gcc/testsuite/c-c++-common/toplevel-asm-1.c
index 12623fcd6668..d6766b00e724 100644
--- a/gcc/testsuite/c-c++-common/toplevel-asm-1.c
+++ b/gcc/testsuite/c-c++-common/toplevel-asm-1.c
@@ -8,7 +8,12 @@ enum E { E0, E1 = sizeof (struct S) + 15 };
 int v[42];
 void foo (void) {}
 
+/* Not all targets can use %cN even in non-pic code.  */
+#if defined(__riscv)
+asm ("# %0 %1 %2 %cc3 %cc4 %5 %% %="
+#else
 asm ("# %0 %1 %2 %c3 %c4 %5 %% %="
+#endif
      :: "i" (sizeof (struct S)),
        "i" (__builtin_offsetof (struct S, c)),
        "i" (E1),

Reply via email to