]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390x regtest: Adjust op00 and op_exception tests for Clang
authorAndreas Arnez <arnez@linux.ibm.com>
Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)
As part of fixing Bug 465782, adjust the op00 and op_exception tests.

The op00 test case doesn't compile with clang because the .hword assembler
directive is not known to llvm-as.  When replacing it with .short, the
test case fails because clang/llvm-as generates different line number
information from gcc/gas.  Using gcc, Valgrind's error message locates the
unrecognised instruction

   at 0x........: main (op00.c:3)

whereas with clang, it shows:

   at 0x........: main (op00.c:4)

The asm statement in op00.c is indeed located at line 4, so when compiling
with gcc, the indicated line number is just wrong.  This is because gas
only updates line number information for instruction directives, not for
directives like `.short' as used here.  See also the discussion in
https://sourceware.org/bugzilla/show_bug.cgi?id=30206

The same applies to the op_exception test case, where `.long' is used to
emit illegal instructions.

Make these test cases independent from this difference, by replacing the
`.short' and `.long' directives by equivalent `.insn' directives.  Also
drop the unnecessary duplication of op00.stderr.exp.

none/tests/s390x/Makefile.am
none/tests/s390x/op00.c
none/tests/s390x/op00.stderr.exp [moved from none/tests/s390x/op00.stderr.exp1 with 92% similarity]
none/tests/s390x/op00.stderr.exp2 [deleted file]
none/tests/s390x/op_exception.c
none/tests/s390x/op_exception.stderr.exp

index 73e7b28e5d9abc38382a4296c9cf7406ec5efefa..8bbbbd1e272ccaf408b9e4a2c339563b3fdd236e 100644 (file)
@@ -37,7 +37,7 @@ EXTRA_DIST = \
        ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \
        ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \
        ecag.stdout.exp-z16 \
-       op00.stderr.exp1 op00.stderr.exp2 op00.vgtest \
+       op00.stderr.exp op00.vgtest \
        fixbr.vgtest fixbr.stderr.exp fixbr.stdout.exp \
        fpext.vgtest fpext.stderr.exp fpext.stdout.exp \
        fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \
index ed243b027178939788fcf7b5aa888189c0addd04..fd9da277b60310a360245114ff1e6fc8ffbc0408 100644 (file)
@@ -1,7 +1,6 @@
 /* Test for invalid instruction 00. */
 int main(int argc, char *argv[])
 {
-  asm volatile (".hword 0\n");
+  asm volatile (".insn e,0x0000");
   return 0;
 }
-
similarity index 92%
rename from none/tests/s390x/op00.stderr.exp1
rename to none/tests/s390x/op00.stderr.exp
index b7552bf58a2548eb0cdb485e75a2cb9091502d12..71825f0e03ad0e9016a2768abd3d4e6e87d82c13 100644 (file)
@@ -1,7 +1,7 @@
 
 vex s390->IR: unknown insn: 0000
 valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op00.c:3)
+   at 0x........: main (op00.c:4)
 Your program just tried to execute an instruction that Valgrind
 did not recognise.  There are two possible reasons for this.
 1. Your program has a bug and erroneously jumped to a non-code
@@ -15,5 +15,5 @@ probably kill your program.
 
 Process terminating with default action of signal 4 (SIGILL)
  Illegal opcode at address 0x........
-   at 0x........: main (op00.c:3)
+   at 0x........: main (op00.c:4)
 
diff --git a/none/tests/s390x/op00.stderr.exp2 b/none/tests/s390x/op00.stderr.exp2
deleted file mode 100644 (file)
index b7552bf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-
-vex s390->IR: unknown insn: 0000
-valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op00.c:3)
-Your program just tried to execute an instruction that Valgrind
-did not recognise.  There are two possible reasons for this.
-1. Your program has a bug and erroneously jumped to a non-code
-   location.  If you are running Memcheck and you just saw a
-   warning about a bad jump, it's probably your program's fault.
-2. The instruction is legitimate but Valgrind doesn't handle it,
-   i.e. it's Valgrind's fault.  If you think this is the case or
-   you are not sure, please let us know and we'll try to fix it.
-Either way, Valgrind will now raise a SIGILL signal which will
-probably kill your program.
-
-Process terminating with default action of signal 4 (SIGILL)
- Illegal opcode at address 0x........
-   at 0x........: main (op00.c:3)
-
index f8dcb9deb6c6430aee39d9af2896db387b9d9288..f4ff9b005bfa82f0abb3d12277de21f8683079c6 100644 (file)
@@ -23,14 +23,14 @@ int main()
        got_ill = 0;
        /* most architectures loop here, but on s390 this would increase the
           PSW by 2 and then by 2 */
-        asm volatile(".long 0\n");
+        asm volatile(".insn e,0x0000\n\t.insn e,0x0000");
         if (got_ill)
                 printf("0x00000000 does not loop\n");
 
        got_ill = 0;
        /* most architectures loop here, but on s390 this would increase the
           PSW by 6 and then by 2*/
-        asm volatile(".long 0xffffffff\n.long 0xffff0000\n");
+        asm volatile(".insn ril,0xffffffffffff,0xf,.-2\n\t.insn e,0x0000");
         if (got_ill)
                 printf("0xffffffff does not loop\n");
        return 0;
index 4373ff5bb3655685c5bdb94183a92b857256d6fd..46dffa52c6a74a03239fa0dc02316ca221d3ddc8 100644 (file)
@@ -1,7 +1,7 @@
 
 vex s390->IR: unknown insn: 0000
 valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op_exception.c:23)
+   at 0x........: main (op_exception.c:26)
 Your program just tried to execute an instruction that Valgrind
 did not recognise.  There are two possible reasons for this.
 1. Your program has a bug and erroneously jumped to a non-code
@@ -14,7 +14,7 @@ Either way, Valgrind will now raise a SIGILL signal which will
 probably kill your program.
 vex s390->IR: unknown insn: 0000
 valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op_exception.c:23)
+   at 0x........: main (op_exception.c:26)
 Your program just tried to execute an instruction that Valgrind
 did not recognise.  There are two possible reasons for this.
 1. Your program has a bug and erroneously jumped to a non-code
@@ -27,7 +27,7 @@ Either way, Valgrind will now raise a SIGILL signal which will
 probably kill your program.
 vex s390->IR: unknown insn: FFFF FFFF FFFF
 valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op_exception.c:30)
+   at 0x........: main (op_exception.c:33)
 Your program just tried to execute an instruction that Valgrind
 did not recognise.  There are two possible reasons for this.
 1. Your program has a bug and erroneously jumped to a non-code
@@ -40,7 +40,7 @@ Either way, Valgrind will now raise a SIGILL signal which will
 probably kill your program.
 vex s390->IR: unknown insn: 0000
 valgrind: Unrecognised instruction at address 0x.........
-   at 0x........: main (op_exception.c:30)
+   at 0x........: main (op_exception.c:33)
 Your program just tried to execute an instruction that Valgrind
 did not recognise.  There are two possible reasons for this.
 1. Your program has a bug and erroneously jumped to a non-code