https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66282
Bug ID: 66282 Summary: Missing x86 floating point conversion on explicit casts violates C standard Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: timo.kreuzer at reactos dot org Target Milestone: --- When compiling floating point code, the compiler omits to convert an intermediate computation result, which is cast to double, to 64 bit precision and instead keeps the internal 80 bit precision. Example code: void bugbug() { double x = 4.4; double y; y = (1 / x); if ( y != ((double)(1 / x)) ) { printf("Standard violation!\n"); } } compiled with "gcc.exe -Wall -g -c fpu.c -o fpu.o" The expression on the right side inside the if() is not converted to double precision, which is in violation of the C standard. Quote: "Implementations employing wide registers have to take care to honor appropriate semantics. Values are independent of whether they are represented in a register or in memory. For example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load is required to round to the precision of the storage type. In particular, casts and assignments are required to perform their specified conversion." Emphasis is on the last sentence. This was tested on a mingw version of the compiler, but I do not think this is mingw specific.