https://gcc.gnu.org/g:573f3bd231e6443bfb2926fa0cb29bbb19b6bd31

commit 573f3bd231e6443bfb2926fa0cb29bbb19b6bd31
Author: Alexandre Oliva <[email protected]>
Date:   Sat Jan 31 01:53:04 2026 -0300

    testsuite: riscv: pr116715.c cannot run with arbitrary arch options
    
    Execution tests shouldn't enable arbitrary cpu extensions without as
    much as checking for support.
    
    The test wants zbs support, but checking for that would just get the
    test skipped.
    
    I'm proposing dropping the arch overriders, so that the test compiles
    and runs for whatever variant we happen to be testing, even if that
    ends up not exercising the expected extension.
    
    Removing dg-options causes the riscv.exp-set default prevail, which
    places the compiler in a stricter mode, so the test no longer
    compiles.  So I adjusted the test to avoid relying on language
    extensions.
    
    I'm not sure allowing the test to run even without the cpu extension
    enabled is ideal.  Perhaps checking for the extension for this run
    test, and having a separate compile test would get us better coverage,
    but I haven't looked into what to check for in such a compile test.
    
    
    for  gcc/testsuite/ChangeLog
    
            * gcc.target/riscv/pr116715.c: Drop unchecked arch overrider.

Diff:
---
 gcc/testsuite/gcc.target/riscv/pr116715.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.target/riscv/pr116715.c 
b/gcc/testsuite/gcc.target/riscv/pr116715.c
index 55daab20171e..f3771483ac5b 100644
--- a/gcc/testsuite/gcc.target/riscv/pr116715.c
+++ b/gcc/testsuite/gcc.target/riscv/pr116715.c
@@ -1,16 +1,17 @@
 /* { dg-do run } */
-/* { dg-options "-march=rv64gc_zbs -mabi=lp64d" { target { riscv64*-*-* } } } 
*/
-/* { dg-options "-march=rv32gc_zbs -mabi=ilp32" { target { riscv32*-*-* } } } 
*/
+/* We want a gc_zbs architecture, but this is a run test, so accept whatever is
+   available.  */
 #include <stdint-gcc.h>
 int32_t a, b;
 int32_t d;
-int64_t f = 695372830942;
+int64_t f = (int64_t)695372 * 1000000 + 830942;
 int main() {
+  int64_t h;
   d = 0;
   for (; d < 1; d = 1)
     --f;
   d |= b = f;
-  int64_t h = d;
+  h = d;
   a = h >> 40;
   if (a != -1)
     __builtin_abort ();

Reply via email to