Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/acle/rwsr-3.c

raw
1 /* Test the __arm_[r,w]sr ACLE intrinsics family. */
2 /* Ensure that illegal behavior is rejected by the compiler. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-std=c2x -O3 -march=armv8-a" } */
6
7 #include <arm_acle.h>
8
9 void
10 test_non_const_sysreg_name ()
11 {
12 const char *regname = "trcseqstr";
13 long long a = __arm_rsr64 (regname); /* { dg-error "first argument to '__builtin_aarch64_rsr64' must be a string literal" } */
14 __arm_wsr64 (regname, a); /* { dg-error "first argument to '__builtin_aarch64_wsr64' must be a string literal" } */
15
16 long long b = __arm_rsr64 (nullptr); /* { dg-error "first argument to '__builtin_aarch64_rsr64' must be a string literal" } */
17 __arm_wsr64 (nullptr, b); /* { dg-error "first argument to '__builtin_aarch64_wsr64' must be a string literal" } */
18 }