aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@vrull.eu>2022-10-03 21:59:50 +0200
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>2022-10-06 12:33:49 +0200
commitb1cfbccc41de6aec950c0f662e7e85ab34bfff8a (patch)
treee136e634e3a239158ea348492741aefbd9ebc0bb /gcc/testsuite/gcc.target
parent85333b9265720fc4e49397301cb16324d2b89aa7 (diff)
downloadgcc-b1cfbccc41de6aec950c0f662e7e85ab34bfff8a.zip
gcc-b1cfbccc41de6aec950c0f662e7e85ab34bfff8a.tar.gz
gcc-b1cfbccc41de6aec950c0f662e7e85ab34bfff8a.tar.bz2
aarch64: fix off-by-one in reading cpuinfo
Fixes: 341573406b39 Don't subtract one from the result of strnlen() when trying to point to the first character after the current string. This issue would cause individual characters (where the 128 byte buffers are stitched together) to be lost. gcc/ChangeLog: * config/aarch64/driver-aarch64.cc (readline): Fix off-by-one. gcc/testsuite/ChangeLog: * gcc.target/aarch64/cpunative/info_18: New test. * gcc.target/aarch64/cpunative/native_cpu_18.c: New test. Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/info_188
-rw-r--r--gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_18.c15
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_18 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_18
new file mode 100644
index 0000000..25061a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_18
@@ -0,0 +1,8 @@
+processor : 0
+BogoMIPS : 2000.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb dcpodp flagm2 frint i8mm bf16 rng ecv
+CPU implementer : 0xc0
+CPU architecture: 8
+CPU variant : 0x0
+CPU part : 0xac3
+CPU revision : 0
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_18.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_18.c
new file mode 100644
index 0000000..b5f0a30
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_18.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_18" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8.6-a\+crc\+fp16\+aes\+sha3\+rng} } } */
+
+/* Test one where the boundary of buffer size would overwrite the last
+ character read when stitching the fgets-calls together. With the
+ test data provided, this would truncate the 'sha512' into 'ha512'
+ (dropping the 'sha3' feature). */