https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110906

            Bug ID: 110906
           Summary: __attribute__((optimize("no-math-errno"))) has no
                    effect.
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cassio.neri at gmail dot com
  Target Milestone: ---

Consider this C++ code compiled with -O3:

double g(double x) {
  return std::sqrt(x);
}

Usually this does call the library function std::sqrt because x might be
negative and errno needs to be set accordingly. Moreover, with -fno-math-errno
a single sqrtsd instruction is emitted. However, annotating g with

__attribute__((optimize("no-math-errno")))

has no effect. This attribute (and #pragma GCC optimize("no-math-errno") ) used
to work up to gcc 5.5.

https://godbolt.org/z/T1nb11bv5

Reply via email to