Bug#693173: gcc-mingw32: float comparison fails assertion only with -std=c99
I also confirm this behavior on x86_64 when compiled with 'gcc -m32 -std=c99'. It seems to happen with 32-bit C99, but not in any other case. -Alan Beadle
Bug#693173: gcc-mingw32: float comparison fails assertion only with -std=c99
I have just now reproduced this bug in Debian Buster x86_64 using i686-w64-mingw32-gcc-win32 with -std=c99 and wine32, using the original example above. Source file foo.c: #include float getfloat() { return 12345.6789f; } int main(void) { assert(12345.6789f == getfloat()); } Steps to reproduce: $ i686-w64-mingw32-gcc-win32 foo.c -std=c99 $ wine ./a.exe Assertion failed: 12345.6789f == getfloat(), file foo.c, line 3 It does not happen when I compile with gcc and run it natively on linux. It also does not happen if I compile with x86_64-w64-mingw32-gcc foo.c -std=c99. Above it was suggested that this might be some kind of expected behavior. I don't know whether that is the case (seems unlikely to me, but I don't know). Just reporting that it still happens. -Alan Beadle
Bug#693173: gcc-mingw32: float comparison fails assertion only with -std=c99
reassign 693173 gcc thanks Hi Ben, On Tue, Nov 13, 2012 at 11:33:01PM +, Ben Golightly wrote: The following three line C programme generates erroneous output when compiled with i586-mingw32msvc-gcc -std=c99 #include assert.h float getfloat() { return 12345.6789f; } int main(void) { assert(12345.6789f == getfloat()); } When running the generated binary, the assertion is always triggered. Steps to reproduce: $ gcc float.c -o float-linux $ i586-mingw32msvc-gcc float.c -o float $ i586-mingw32msvc-gcc float.c -o float-c99 -std=c99 $ ./float-linux // works $ wine ./float // works $ wine ./float-c99 // outputs Assertion failed! The following causes the assertion too, using gcc 4.7.2: % gcc -std=c99 float.c -o float-linux-c99 % ./float-linux-c99 float-linux-c99: float.c:3: main: Assertion `12345.6789f == getfloat()' failed. It seems this bug is not specific to gcc-mingw32, but is either really a bug in gcc or expected behaviour in C99 (I don't know which). Incidentally, since you're running unstable, you can use the i686-w64-mingw32 triplet instead of i586-mingw32msvc; the latter will be going away at some point... Regards, Stephen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#693173: gcc-mingw32: float comparison fails assertion only with -std=c99
Package: gcc-mingw32 Version: 4.6.3-8+7 Severity: important Dear Maintainer, The following three line C programme generates erroneous output when compiled with i586-mingw32msvc-gcc -std=c99 #include assert.h float getfloat() { return 12345.6789f; } int main(void) { assert(12345.6789f == getfloat()); } When running the generated binary, the assertion is always triggered. Steps to reproduce: $ gcc float.c -o float-linux $ i586-mingw32msvc-gcc float.c -o float $ i586-mingw32msvc-gcc float.c -o float-c99 -std=c99 $ ./float-linux // works $ wine ./float // works $ wine ./float-c99 // outputs Assertion failed! More information: $ wine --version wine-1.4.1 Regards, Ben golightly@googlemail.com -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-mingw32 depends on: ii binutils-mingw-w64-i686 2.22-7+2 ii g++-mingw-w64-i686 4.6.3-8+7 ii gcc-mingw-w64-base 4.6.3-8+7 ii gcc-mingw-w64-i686 4.6.3-8+7 ii gfortran-mingw-w64-i686 4.6.3-8+7 gcc-mingw32 recommends no packages. gcc-mingw32 suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org