Commit 0d28ee45 authored by Simon McVittie's avatar Simon McVittie

type-test: do not rely on signed integer overflow wrapping around

Signed integer overflow is undefined behaviour: if a compiler
detects signed integer overflow, it is free to compile it to absolutely
anything.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
parent 4496ef91
......@@ -88,15 +88,15 @@ main (int argc,
g_assert (gsz == 0);
gs = G_MAXSHORT;
gs++;
gs = (gshort) (1 + (gushort) gs);
g_assert (gs == G_MINSHORT);
gi = G_MAXINT;
gi++;
gi = (gint) (1 + (guint) gi);
g_assert (gi == G_MININT);
gl = G_MAXLONG;
gl++;
gl = (glong) (1 + (gulong) gl);
g_assert (gl == G_MINLONG);
/* Test the G_G(U)?INT(16|32|64)_FORMAT macros */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment