Floating point bug using -std=c99 flag for GCC

Bug #899596 reported by Edward Chapin on 2011-12-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.6 (Ubuntu)
Undecided
Unassigned

Bug Description

After a recent Ubuntu upgrade I ran into a peculiar double-precision floating point comparison bug using the default GCC 4.6.1 package.

The essence of the bug is that I define a floating point constant which I then assign to a double precision variable. However, an equality test between this variable and the constant fails when using the "-std=c99" compiler flag (but works if I don't). I have attached a simple test program to this report with details of the compiler invocation and outputs at the top.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: gcc-4.6 4.6.1-9ubuntu3
ProcVersionSignature: Ubuntu 3.0.0-13.22-generic 3.0.6
Uname: Linux 3.0.0-13-generic i686
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Sat Dec 3 06:01:45 2011
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-4.6
UpgradeStatus: Upgraded to oneiric on 2011-10-16 (47 days ago)

Edward Chapin (edward-chapin) wrote :

Some additional information: a colleague has reproduced this bug on different Ubuntu 11.10 systems and has made the following observations:

1. The test program attached to this report works on 64bit using -m64
2. The test program also works with clang in both 32-bit and 64-bit modes

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers