[Bug c++/69657] abs() not inlined after including math.h

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 3 22:49:00 GMT 2016


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-02-03
          Component|libstdc++                   |c++
            Summary|[6 Regression] abs() not    |abs() not inlined after
                   |inlined after including     |including math.h
                   |math.h                      |
     Ever confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> using foo::abs;

I forgot to mention that without this line you get the expected output.

The same thing happens with no mention of std and no libstdc++ headers at all:

namespace foo
{
  inline double
  abs(double x)
  { return __builtin_fabs(x); }
}
using foo::abs;

extern "C" int abs(int);

namespace bar {
  using ::abs;
}

int
wrap_abs (int x)
{
  return bar::abs (x) + bar::abs(x);
}


It seems that overloading a built-in prevents it being recognised as a
built-in.

Recategorising as component=c++, and removing the regression marker (because
the change in libstdc++ that reveals this issue is required for conformance).


More information about the Gcc-bugs mailing list