A bug has been reported to gstreamer bug tracker: https://bugzilla.gnome.org/show_bug.cgi?id=745667 This bug seems to be related to gcc optimization behaviour. The operations needs specific cast for operation with double and integers.
To provide more details, the code in question is basically float x = ...; int y = x * INTEGER_LITERAL; if x < 1.0, this always resulted in 0. Adding casts like int y = (int) ((double) x * (double) INTEGER_LITERAL); fixed it. The problem only happened with -O1 and -O2 on ARM(v7), not with -O0. And also went away after adding some debug printf() around the code in question. gcc 4.9 was used here.
http://comments.gmane.org/gmane.linux.embedded.yocto.meta-freescale/13018 also has other mentions of this bug.
Can you please provide a stand-alone testcase (that maybe calls abort() if the alleged bug occurs)?
http://pastebin.com/stQFwaSg Here is a sample which is supposed to describe the same behaviour as in gstvolume.c but i'm not able to reproduce it with this code. Here is my build command line: arm-oad-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 -O2 -pipe -g -feliminate-unused-debug-types test_float.c -o test_float
Created attachment 34963 [details] assembly code Here is the command line: arm-oad-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter -std=gnu99 -DHAVE_CONFIG_H -I. -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/work/cortexa9hf-vfp-neon-mx6-oad-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst/volume -I../.. -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/work/cortexa9hf-vfp-neon-mx6-oad-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst-libs -I../../gst-libs -pthread -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/gstreamer-1.0 -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/glib-2.0 -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/lib/glib-2.0/include -pthread -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/glib-2.0 -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/lib/glib-2.0/include -pthread -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/gstreamer-1.0 -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/glib-2.0 -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/lib/glib-2.0/include -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -Wall -Wdeclaration-after-statement -Wvla -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs -I/home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/sysroots/jupiter/usr/include/orc-0.4 -O2 -pipe -g -feliminate-unused-debug-types -S /home/sce/DEV/yocto-oad-dizzy/build_oad-jupiter/tmp/work/cortexa9hf-vfp-neon-mx6-oad-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst/volume/gstvolume.c -fPIC -DPIC -o .libs/libgstvolume_la-gstvolume.o
Can you provide the assembly code with and without the added casts?
It is already without the cast ...
Created attachment 34973 [details] assembly code This is the version with float casting
The assembly code looks exactly the same to me, except for the source locations. But I also don't see the multiplication in either, only conversion between integers and floating point values, and then storing the results. It's near line 254 in the original source for both.
Do you have the preprocessed source?
No testcase supplied