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.
Regstrapped on x86_64-linux-gnu along with other patches in this batch;
also tested with targets riscv64-elf and riscv32-elf on the same host,
both trunk and gcc-15. Ok to install?
for gcc/testsuite/ChangeLog
* gcc.target/riscv/pr116715.c: Drop unchecked arch overrider.
---
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 55daab20171ec..f3771483ac5b9 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 ();
--
Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/
Free Software Activist FSFLA co-founder GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!