[glib] gdbus-serialization test: don't left-shift a negative number



commit 663e12feca1c45c19048c43f7f80f2509a3fadba
Author: Simon McVittie <smcv debian org>
Date:   Fri Dec 2 10:06:23 2016 +0000

    gdbus-serialization test: don't left-shift a negative number
    
    -2LL<<34 is undefined, because left-shifting a negative number is
    undefined (it was implementation-defined behaviour in C99, but
    is formally undefined in C11). The undefined behaviour sanitizer
    picks this up.
    
    Signed-off-by: Simon McVittie <smcv debian org>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
    Reviewed-by: Colin Walters

 gio/tests/gdbus-serialization.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index a405189..2002a92 100644
--- a/gio/tests/gdbus-serialization.c
+++ b/gio/tests/gdbus-serialization.c
@@ -650,7 +650,7 @@ message_serialize_basic (void)
                                       60000,
                                       -44,
                                       100000,
-                                      -G_GINT64_CONSTANT(2)<<34,
+                                      -(G_GUINT64_CONSTANT(2)<<34),
                                       G_GUINT64_CONSTANT(0xffffffffffffffff),
                                       42.5),
                        "value 0:   string: 'this is a string'\n"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]