Fix gdb.base/structs2.exp with Clang
authorPedro Alves <palves@redhat.com>
Thu, 2 Jul 2020 18:32:40 +0000 (19:32 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 3 Jul 2020 14:01:22 +0000 (15:01 +0100)
gdb.base/structs2.exp fails to run with Clang, because of:

 gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:14: warning:
       implicit conversion from 'int' to 'signed char' changes value from 130 to
       -126 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~  ^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:24: warning:
       implicit conversion from 'int' to 'short' changes value from 33000 to
       -32536 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~            ^~~~~
 2 warnings generated.

 === gdb Summary ===

 # of untested testcases         1

Fix it by passing actual negative numbers.

gdb/testsuite/ChangeLog:

* gdb.base/structs2.c (main): Adjust second parem_reg call to
explicitly write negative numbers.
* gdb.base/structs2.exp: Adjust expected output.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/structs2.c
gdb/testsuite/gdb.base/structs2.exp

index 79c1208bd50a97e3d77fd6cf934fe5dc599b3f75..983c4315bfb543c069c773296799ce84df63d343 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-03  Pedro Alves  <palves@redhat.com>
+
+       * gdb.base/structs2.c (main): Adjust second parem_reg call to
+       explicitly write negative numbers.
+       * gdb.base/structs2.exp: Adjust expected output.
+
 2020-07-03  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/charset.c (init_string): Change all char parameters to
index 7c8be035221d12446b36060722a898071f64452e..aac7bce8c155e24c72e6aeff2ae7e611565ce75e 100644 (file)
@@ -13,7 +13,7 @@ main ()
 
   bkpt = 0;
   param_reg (120, 130, 32000, 33000);
-  param_reg (130, 120, 33000, 32000);
+  param_reg (-120, 130, -32000, 33000);
 
   return 0;
 }
index 8a7d9c693783dc6812f4802188c52a166b3b5cbc..5722be3109c2851de2682ae7c10fc0f0a077094b 100644 (file)
@@ -49,5 +49,5 @@ if [test_compiler_info gcc-3-*] {
   setup_xfail hppa*-* gcc/15860
 }
 gdb_test "continue" \
-    ".*pr_char=-126.*pr_uchar=120.*pr_short=-32536.*pr_ushort=32000.*bkpt = 1.*" \
+    ".*pr_char=-120.*pr_uchar=130.*pr_short=-32000.*pr_ushort=33000.*bkpt = 1.*" \
     "structs2 continue2"