This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/55522] New: -funsafe-math-optimizations is unexpectedly harmful, especially w/ -shared


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522

             Bug #: 55522
           Summary: -funsafe-math-optimizations is unexpectedly harmful,
                    especially w/ -shared
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: luto@mit.edu


The docs for -funsafe-math-optimizations say:

When used at link-time, it may include libraries or startup files that change
the default FPU control word or other similar optimizations. 

This is, IMO, really bad.  One might naively assume (if you haven't thought
about that) that -ffast-math and -funsafe-math-optimizations merely affect code
generation.  This is true if you *compile* with -ffast-math, but if you *link*
with it, then you end up breaking IEEE758 semantics program-wide.  This causes
real-life problems.

Please consider some combination of:

1. Making -funsafe-math-optimizations illegal when combined with -shared.

2. Splitting the inclusion of crtfastmath.o into its own option
(-funsafe-math-mode-at-startup, perhaps) and make -ffast-math (and -Ofast) not
set that one.

3. Mention in the docs just how bad this is in shared libraries.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]