Re: was: bad datatypes time and timestamp - wrong gcc option

Started by Thomas Lockhartover 25 years ago2 messages
#1Thomas Lockhart
lockhart@alumni.caltech.edu

(copied to -hackers)

you were right about the wrong compiler-options: it was not the -O3 but
the -ffast-math option that made the wrong rounding (and other stuff) ;-)
I compiled a ManDrake source RPM that used the default rpmrc in
/usr/lib/rpm/rpmrc, in which the optflags are set incorrectly:

... -O3 ... -ffast-math ...

But this behaviour may be found in any distribution based onto the RedHat
system, at least when utilizing the RPM-utility unchanged. My RPM is
version 3.0.3 here.
The manpage of gcc does not suggest to use the -ffast-math with any of the
-O options.
When I removed the -ffast-math option, your time and timestamp datatypes
worked perfectly.
A hot fix for the SPEC-file would be, to eliminate that option by
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e "s/-ffast-math//"`
after the %build line. On the long term there should be a discussion, if
that option is realy OK for doing all the packages...
BTW: I'm using ManDrake 7.0 and took a postgresql-7.0.2-2mdk.src.rpm from a
server and compiled it for a target i586-pc-linux-gnu on an i686.

Thanks for tracking this down. I'll look at my RPM setup for
Mandrake-7.1 to confirm the behavior, and then perhaps Lamar can
introduce an appropriate fix to the canonical spec file.

- Thomas

#2Lamar Owen
lamar.owen@wgcr.org
In reply to: Thomas Lockhart (#1)

Thomas Lockhart wrote:

you were right about the wrong compiler-options: it was not the -O3 but
the -ffast-math option that made the wrong rounding (and other stuff) ;-)
I compiled a ManDrake source RPM that used the default rpmrc in
/usr/lib/rpm/rpmrc, in which the optflags are set incorrectly:

... -O3 ... -ffast-math ...

But this behaviour may be found in any distribution based onto the RedHat
system, at least when utilizing the RPM-utility unchanged. My RPM is
version 3.0.3 here.

On my RedHat 6.2 buildbox, I get -02 -m486 -fno_strength_reduce (using
the very useful 'rpm --showrc|grep optflags' -- the optflags macro gets
placed in the RPM_OPT_FLAGS envvar during rpm startup) -- sounds like a
Mandrakeism.

A hot fix for the SPEC-file would be, to eliminate that option by
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e "s/-ffast-math//"`

Thanks for tracking this down. I'll look at my RPM setup for
Mandrake-7.1 to confirm the behavior, and then perhaps Lamar can
introduce an appropriate fix to the canonical spec file.

I will look into doing this, although Mandrake really should fix this,
if it is not recommended by the gcc people to combine -O stuff and
-ffast_math.

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11