]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Cast char constant to int in sizeof.exp
authorTom Tromey <tom@tromey.com>
Wed, 30 Aug 2017 22:12:56 +0000 (16:12 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 6 Sep 2017 17:11:03 +0000 (11:11 -0600)
PR gdb/22010 concerns a regression I introduced with the scalar
printing changes.  The bug is that this code in sizeof.exp:

    set signof_byte [get_integer_valueof "'\\377'" -1]

can incorrectly compute sizeof_byte.  One underlying problem here is
that gdb's C parser doesn't treat a char constant as an int (this is
PR 19973).

However, it seems good to have an immediate fix for the regression.
The simplest is to cast to an int here.

testsuite/ChangeLog
2017-09-05  Tom Tromey  <tom@tromey.com>

PR gdb/22010:
* gdb.base/sizeof.exp (check_valueof): Cast char constant to int.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/sizeof.exp

index a4f2a145f7ca95106333aefef427b52c12e0ff67..62d929c837482fa64e9ecfc698199b66f38fc410 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-05  Tom Tromey  <tom@tromey.com>
+
+       PR gdb/22010:
+       * gdb.base/sizeof.exp (check_valueof): Cast char constant to int.
+
 2017-09-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * gdb.arch/thumb2-it.exp: Cast call to assembly defined function.
index 5d8940715cf21c92f2950c403ef84e7d2ae5b3cc..13d36f8a93572cf83fb6e32f2ebf97ea9cc81a81 100644 (file)
@@ -86,7 +86,7 @@ proc check_valueof { exp val } {
 
 # Check that GDB and the target agree over the sign of a character.
 
-set signof_byte [get_integer_valueof "'\\377'" -1]
+set signof_byte [get_integer_valueof "(int) '\\377'" -1]
 set signof_char [get_integer_valueof "(int) (char) -1" -1]
 set signof_signed_char [get_integer_valueof "(int) (signed char) -1" -1]
 set signof_unsigned_char [get_integer_valueof "(int) (unsigned char) -1" -1]