GNOME Bugzilla – Bug 760769
tests:audioconvert: Build error when running make check
Last modified: 2016-01-19 07:58:05 UTC
Due to changes made in https://bugzilla.gnome.org/show_bug.cgi?id=760134 getting the below errors while running make check. elements/audioconvert.c:815:18: error: integer overflow in expression [-Werror=overflow] (gdouble) (-(32768L << 16)) / 2147483648.0, /* ~ -1.0 */ ^ elements/audioconvert.c:825:25: error: integer overflow in expression [-Werror=overflow] gint32 in[] = { 0, (-(1L << 31)), (1L << 30), (-(1L << 30)) }; ^ elements/audioconvert.c:827:18: error: integer overflow in expression [-Werror=overflow] (gdouble) (-(1L << 31)) / 2147483648.0, /* ~ -1.0 */ This happens because 32768L << 16 and 1L << 31 is 2147483648 but it exceeds the positive range of int which is 2147483647.
Created attachment 319239 [details] [review] fix integer overflow build error proposed patch to fix by using long long(LL) instead of long(L).
Comment on attachment 319239 [details] [review] fix integer overflow build error LL is AFAIK supported by MSVC, which is why G_GINT64_CONSTANT and G_GUINT64_CONSTANT exists. Please use the latter to make sure it's used as an unsigned integer :)
Created attachment 319316 [details] [review] fix int using G_GINT64_CONSTANT instead of LL. When using unsigned integer, G_GUINT64_CONSTANT, the value of (gdouble) (-(G_GUINT64_CONSTANT(32768) << 16)) / 2147483648.0 is coming as 8589934591.000000. and the value of -(G_GUINT64_CONSTANT (1) << 31) is coming as 18446744071562067968 Hence using signed integer.
Created attachment 319317 [details] [review] fix integer overflow build error reattaching patch
commit 4d2e338fe2d76b4621bbb66ae5f3740bd7ae8f9f Author: Vineeth TM <vineeth.tm@samsung.com> Date: Mon Jan 18 11:40:36 2016 +0900 tests:audioconvert: Fix integer overflow build error value of 32768L << 16 and 1L << 31 is 2147483648 but it exceeds the positive range of int which is 2147483647 resulting in integer overflow error. Use G_GINT64_CONSTANT instead of L. https://bugzilla.gnome.org/show_bug.cgi?id=760769