#256 Optimizer bug, possibly related to isinf

open
nobody
None
5
2011-12-12
2011-12-12
Andrew Dunstan
No

gcc version is: i686-w64-mingw32-gcc.exe (GCC) 4.7.0 20111123 (experimental)
Platform is Mingw on Windows 7 HE SP1 64 bit, Athlon II X2 215

Building PostgreSQL from git tip (git clone git://github.com/postgres/postgres.git), configure --enable-cassert --enable-debug, then make && make check. This produces a regression failure in the PostgreSQL float8 test, specifically the error apparently occurs during a call to src/backend/utils/adt/float.c:float8mul(). It appears that there is some problem with isinf.

If CFLAGS=-O0 is set before configure, and the process is repeated, the error does not recur.

This code works on the same machine with gcc version "x86_64-w64-mingw32-gcc.exe (GCC) 4.5.3 20110401 (prerelease)"

Discussion

  • Kai Tietz
    Kai Tietz
    2011-12-12

    Hmm, is there a repository html link to the file(function) src/backend/utils/adt/float.c:float8mul()?

    AFAICS from report, the issue happens with value 1e200 (as invalid range). The issue I might see here (as it doesn't occure with x64 version, which uses sse instructions instead of x87) is that x87 registers internally have higher precision then 32-bit. So failures in range occure on conversion from FPU register down to memory store. For x64 SSE this is different, as here math operations are really just done in specified precission.
    Have you checked, if you get different result by using on 32-bit explicit SSE instructions?

    As things seems to work at -O0, but not at -On (with n > 0), it is pretty unlikely that runtime-functions itself are causing this issue. So therefore my guess goes here for internal/external precision of used FPU.

    Kai

     
  • Kai Tietz
    Kai Tietz
    2012-01-19

    Hmm, I tried to reproduce it with 4.7 gcc for 32-bit, but i can't. How exactly is the float8 defined?
    Also what way PG_GETARG_FLOAT8(0); and PG_FUNCTION_ARGS macros are defined?