[Bug target/55522] -funsafe-math-optimizations is unexpectedly harmful, especially w/ -shared

2016-02-02 Thread spathiwa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522

Craig Smith  changed:

   What|Removed |Added

 CC||spathiwa at gmail dot com

--- Comment #5 from Craig Smith  ---
This issue is really, really bad, and has potential to start changing more and
more run-time behavior of downstream libraries and apps the longer this bug
persists.

For example, on RHEL 7, liblzma.so.5 is linked with -Ofast, which also triggers
crtfastmeth.o to be used, corrupting the mxcsr register at library load time.
(The bug might be specific to RedHat, because -Ofast is added in the rpm spec.)

For some reason, Open GL libraries (libglapi) depend on libselinux which
depends on liblzma.

So ANY open GL app on RHEL will now have its math/IEEE754 semantics broken.

That's terrible.

crtfastmath.o should NEVER be used when linking shared libraries, regardless of
options.

[Bug target/55522] -funsafe-math-optimizations is unexpectedly harmful, especially w/ -shared

2016-02-02 Thread spathiwa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522

--- Comment #7 from Craig Smith  ---
(In reply to Orion Poplawski from comment #6)
> (In reply to Craig Smith from comment #5)
> > For example, on RHEL 7, liblzma.so.5 is linked with -Ofast, which also
> > triggers crtfastmath.o to be used, corrupting the mxcsr register at library
> > load time.
> > (The bug might be specific to RedHat, because -Ofast is added in the rpm
> > spec.)
> 
> I don't see any evidence of liblzma.so.5 being linked with -Ofast on RHEL7,
> can you point to that?

The xz.spec file from the xz-5.1.2-0.alpha.1 source RPM includes the following:

%build
export CONFIGURE_TOP=`pwd`
mkdir objs
pushd objs
CFLAGS="%{optflags} -Ofast -funroll-loops" \
%configure2_5x
%make
popd

[Bug target/55522] -funsafe-math-optimizations is unexpectedly harmful, especially w/ -shared

2016-02-02 Thread spathiwa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522

--- Comment #10 from Craig Smith  ---
(In reply to Orion Poplawski from comment #8)
> That version does not exist in RHEL7.  Looks like it was a Mandriva thing:
> https://www.rpmfind.net/linux/RPM/mandriva/devel/cooker/x86_64/media/main/
> release/xz-5.1.2-0.alpha.1.x86_64.html

rpm -qi liblzma5 on my RHEL 7 system says that the source RPM is the one I
mentioned, with build host 'n2.mandriva.com'.  Not sure why this is that case,
if a build image got corrupted or someone manually installed an rpm form
Mandriva on this system without my knowledge.

In any case, the GCC bug is causing real issues, even if possibly not on RHEL
7.  I'll find another RHEL 7 system and check.