[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #16 from Jonathan Wakely  ---
Fixed for gcc 7

--- Comment #17 from Jonathan Wakely  ---
Author: redi
Date: Mon Jan  9 17:15:58 2017
New Revision: 244231

URL: https://gcc.gnu.org/viewcvs?rev=244231=gcc=rev
Log:
PR79017 workaround incomplete C99 math on darwin

PR libstdc++/79017
* acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Check for llrint and llround
functions separately on darwin and if they're missing define
_GLIBCXX_NO_C99_ROUNDING_FUNCS.
* config.h.in: Regenerate.
* configure: Regenerate.
* include/c_global/cmath [_GLIBCXX_NO_C99_ROUNDING_FUNCS] (llrint)
(llrintf, llrintl, llround, llroundf, llroundl): Do not define.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/acinclude.m4
trunk/libstdc++-v3/config.h.in
trunk/libstdc++-v3/configure
trunk/libstdc++-v3/include/c_global/cmath

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #16 from Jonathan Wakely  ---
Fixed for gcc 7

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #15 from Jeffrey Walton  ---
(In reply to Jonathan Wakely from comment #14)
> OK, thanks. I'm not going to try to add declarations like the libc++ patch
> does, as it looks like that would only be correct for Snow Leopard and not
> earlier.
> 
> I'll just add more fine-grained configure checks and if they're not declared
> in  then they won't be available, period. There's only so much we
> can do to work around buggy C libraries on the target.

Ack, thanks.

The MacPorts, Brew, Fink (etc) folks thank you.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #14 from Jonathan Wakely  ---
OK, thanks. I'm not going to try to add declarations like the libc++ patch
does, as it looks like that would only be correct for Snow Leopard and not
earlier.

I'll just add more fine-grained configure checks and if they're not declared in
 then they won't be available, period. There's only so much we can do
to work around buggy C libraries on the target.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #13 from Jeffrey Walton  ---
(In reply to Jonathan Wakely from comment #12)
> What's the error?

My bad...

$ cat test.cxx
// #include 
long long llrint(double x);
long long llrintf(float x);
long long llrintl(long double x);
long long llround(double x);
long long llroundf(float x);
long long llroundl(long double x);

int main()
{
  llrint(0.0);
  llrintf(0.0f);
  llrintl(0.0l);
  llround(0.0);
  llroundf(0.0f);
  llroundl(0.0l);
  return 0;
}

$ /opt/local/bin/g++-mp-5 -std=c++11 test.cxx -o test.exe
Undefined symbols for architecture ppc:
  "llrint(double)", referenced from:
  _main in ccK6psnG.o
  "llrintf(float)", referenced from:
  _main in ccK6psnG.o
  "llrintl(long double)", referenced from:
  _main in ccK6psnG.o
  "llround(double)", referenced from:
  _main in ccK6psnG.o
  "llroundf(float)", referenced from:
  _main in ccK6psnG.o
  "llroundl(long double)", referenced from:
  _main in ccK6psnG.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #12 from Jonathan Wakely  ---
What's the error?

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #11 from Jeffrey Walton  ---

> Does this C program compile and link on 10.4 and 10.5?
> 
> long long llrint(double x);
> long long llrintf(float x);
> long long llrintl(long double x);
> long long llround(double x);
> long long llroundf(float x);
> long long llroundl(long double x);
> 
> int main()
> {
>   llrint(0.0);
>   llrintf(0.0f);
>   llrintl(0.0l);
>   llround(0.0);
>   llroundf(0.0f);
>   llroundl(0.0l);
>   return 0;
> }

Confirmed it _did not_ compile on OS X 10.5.8. I tried with/without 'extern',
and with/without '-lm'.

Sorry about the false alarm.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-07 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #10 from Jonathan Wakely  ---
(In reply to Jeffrey Walton from comment #9)
> This patch for libc++ may be useful to you for OS X 10.6 and below (thanks
> to KC):
> https://github.com/jeremyhu/libcxx/commit/
> 720feba4874d4ca3131753dc31af127e3c509c36

Hmm, that doesn't match your results above that say the missing functions for
10.5 (Leopard) are the llrint and llround ones.

It would be strange if they added llround to Snow Leopard but removed lrint.

Does this C program compile and link on 10.4 and 10.5?

long long llrint(double x);
long long llrintf(float x);
long long llrintl(long double x);
long long llround(double x);
long long llroundf(float x);
long long llroundl(long double x);

int main()
{
  llrint(0.0);
  llrintf(0.0f);
  llrintl(0.0l);
  llround(0.0);
  llroundf(0.0f);
  llroundl(0.0l);
  return 0;
}

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #9 from Jeffrey Walton  ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Jeffrey Walton from comment #0)
> > test.cxx:53:21: error: 'llrint' was not declared in this scope
> >llrint(0.0);
> >  ^
> > test.cxx:54:23: error: 'llrintf' was not declared in this scope
> >llrintf(0.0f);
> >^
> > test.cxx:55:23: error: 'llrintl' was not declared in this scope
> >llrintl(0.0l);
> >^
> > test.cxx:56:22: error: 'llround' was not declared in this scope
> >llround(0.0);
> >   ^
> > test.cxx:57:24: error: 'llroundf' was not declared in this scope
> >llroundf(0.0f);
> > ^
> > test.cxx:58:24: error: 'llroundl' was not declared in this scope
> >llroundl(0.0l);
> > ^
> 
> Because these six functions are missing we treat all C99 math functions as
> missing. We could split the checks into two pieces, so we check for these
> separately, which would allow the rest of the C99 math library to be
> imported into namespace std.

This patch for libc++ may be useful to you for OS X 10.6 and below (thanks to
KC):
https://github.com/jeremyhu/libcxx/commit/720feba4874d4ca3131753dc31af127e3c509c36

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #8 from Jeffrey Walton  ---

> Wow, this is a surprising statistic (for me)... OS X 10.5 makes up 29.1% of
> the MacPorts downloads. Its the largest percentage for the OS group. Confer,
> http://stats.macports.neverpanic.de/os_statistics#osx_version.
> 
> Also, according to https://trac.macports.org/ticket/53226#comment:5, the
> issue affects both PPC and Intel machines. So it affects 100% of the
> architectures (even though PPC makes up less than 2%).
> 
> I wonder how many Homebrew or Fink users (et al) have similar statistics.

My bad... I misread the statistic because both OS X 10.11 and 10.5 use green
(thanks CL). According to the statistic, OS X 10.5 appears to account for 5%
for the group.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #7 from Jeffrey Walton  ---
(In reply to Jeffrey Walton from comment #5)
> (In reply to Jonathan Wakely from comment #2)
> ...
> > But OS X 10.5.8 is pretty old, and this might not be worth doing if it
> > doesn't affect current versions of OS x.
> 
> The issue seems to affect Android as well:
> http://stackoverflow.com/q/22922961. I am not sure if its the exact same
> issue however.
> 
> Splitting the checks may benefit more than an ancient PowerMac.
> 
> For what its worth, I keep the antique hardware around for testing on the
> PowerPC, which is big-endian. Otherwise it would be retired.

Wow, this is a surprising statistic (for me)... OS X 10.5 makes up 29.1% of the
MacPorts downloads. Its the largest percentage for the OS group. Confer,
http://stats.macports.neverpanic.de/os_statistics#osx_version.

Also, according to https://trac.macports.org/ticket/53226#comment:5, the issue
affects both PPC and Intel machines. So it affects 100% of the architectures
(even though PPC makes up less than 2%).

I wonder how many Homebrew or Fink users (et al) have similar statistics.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread egall at gwmail dot gwu.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

Eric Gallager  changed:

   What|Removed |Added

 CC||egall at gwmail dot gwu.edu

--- Comment #6 from Eric Gallager  ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Jeffrey Walton from comment #0)
> > test.cxx:53:21: error: 'llrint' was not declared in this scope
> >llrint(0.0);
> >  ^
> > test.cxx:54:23: error: 'llrintf' was not declared in this scope
> >llrintf(0.0f);
> >^
> > test.cxx:55:23: error: 'llrintl' was not declared in this scope
> >llrintl(0.0l);
> >^
> > test.cxx:56:22: error: 'llround' was not declared in this scope
> >llround(0.0);
> >   ^
> > test.cxx:57:24: error: 'llroundf' was not declared in this scope
> >llroundf(0.0f);
> > ^
> > test.cxx:58:24: error: 'llroundl' was not declared in this scope
> >llroundl(0.0l);
> > ^
> 
> Because these six functions are missing we treat all C99 math functions as
> missing. We could split the checks into two pieces, so we check for these
> separately, which would allow the rest of the C99 math library to be
> imported into namespace std.
> 
> But OS X 10.5.8 is pretty old, and this might not be worth doing if it
> doesn't affect current versions of OS x.

10.5.8 is what I'm still on, too. Iain Sandoe has been committing patches
targeting 10.4 and 10.5 recently, as well. I'd say it's worth doing.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #5 from Jeffrey Walton  ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Jeffrey Walton from comment #0)
> ...   ^
> 
> Because these six functions are missing we treat all C99 math functions as
> missing. We could split the checks into two pieces, so we check for these
> separately, which would allow the rest of the C99 math library to be
> imported into namespace std.
> 
> But OS X 10.5.8 is pretty old, and this might not be worth doing if it
> doesn't affect current versions of OS x.

The issue seems to affect Android as well: http://stackoverflow.com/q/22922961.
I am not sure if its the exact same issue however.

Splitting the checks may benefit more than an ancient PowerMac.

For what its worth, I keep the antique hardware around for testing on the
PowerPC, which is big-endian. Otherwise it would be retired.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #4 from Jeffrey Walton  ---
(In reply to Jonathan Wakely from comment #3)
> Jeffrey, could you please add the output of '/opt/local/bin/g++-mp-5
> -dumpmachine' to the Target field of this bug report? Thanks.

  $ /opt/local/bin/g++-mp-5 -dumpmachine
  ppc-apple-darwin9

If it matters, the machine is 32-bit by default:

  $ getconf LONG_BIT
  32

But its capable of 64-bit code with -m64 or -arch ppc64.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #3 from Jonathan Wakely  ---
Jeffrey, could you please add the output of '/opt/local/bin/g++-mp-5
-dumpmachine' to the Target field of this bug report? Thanks.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-01-06
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
(In reply to Jeffrey Walton from comment #0)
> test.cxx:53:21: error: 'llrint' was not declared in this scope
>llrint(0.0);
>  ^
> test.cxx:54:23: error: 'llrintf' was not declared in this scope
>llrintf(0.0f);
>^
> test.cxx:55:23: error: 'llrintl' was not declared in this scope
>llrintl(0.0l);
>^
> test.cxx:56:22: error: 'llround' was not declared in this scope
>llround(0.0);
>   ^
> test.cxx:57:24: error: 'llroundf' was not declared in this scope
>llroundf(0.0f);
> ^
> test.cxx:58:24: error: 'llroundl' was not declared in this scope
>llroundl(0.0l);
> ^

Because these six functions are missing we treat all C99 math functions as
missing. We could split the checks into two pieces, so we check for these
separately, which would allow the rest of the C99 math library to be imported
into namespace std.

But OS X 10.5.8 is pretty old, and this might not be worth doing if it doesn't
affect current versions of OS x.

[Bug libstdc++/79017] Old PowerMac G5, MacPorts GCC 5.4, C++11 and "std::log2 has not been declared"

2017-01-06 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79017

--- Comment #1 from Jeffrey Walton  ---
Also see Issue 53226 in the MacPorts issue tracker. "gcc5 @5.4: error:
'std::log2' has not been declared", https://trac.macports.org/ticket/53226.