After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760769 - tests:audioconvert: Build error when running make check
tests:audioconvert: Build error when running make check
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.7.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-18 02:40 UTC by Vineeth
Modified: 2016-01-19 07:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix integer overflow build error (1.71 KB, patch)
2016-01-18 02:44 UTC, Vineeth
none Details | Review
fix int (1.77 KB, patch)
2016-01-19 00:24 UTC, Vineeth
none Details | Review
fix integer overflow build error (1.77 KB, patch)
2016-01-19 00:25 UTC, Vineeth
committed Details | Review

Description Vineeth 2016-01-18 02:40:46 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.
Comment 1 Vineeth 2016-01-18 02:44:33 UTC
Created attachment 319239 [details] [review]
fix integer overflow build error

proposed patch to fix by using long long(LL) instead of long(L).
Comment 2 Sebastian Dröge (slomo) 2016-01-18 07:14:08 UTC
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 :)
Comment 3 Vineeth 2016-01-19 00:24:38 UTC
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.
Comment 4 Vineeth 2016-01-19 00:25:54 UTC
Created attachment 319317 [details] [review]
fix integer overflow build error

reattaching patch
Comment 5 Sebastian Dröge (slomo) 2016-01-19 07:57:50 UTC
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