[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2007-11-26 Thread paolo at gcc dot gnu dot org


--- Comment #7 from paolo at gcc dot gnu dot org  2007-11-26 18:25 ---
Subject: Bug 25913

Author: paolo
Date: Mon Nov 26 18:24:54 2007
New Revision: 130443

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=130443
Log:
2007-11-26  Paolo Carlini  [EMAIL PROTECTED]

PR libstdc++/25913
* include/c_std/cmath (std::fpclassify, isfinite, isinf, isnan,
isnormal, signbit, isgreater, isgreaterequal, isless, islessequal,
islessgreater, isunordered): Guard with __enable_if and forward
with __promote.
* include/c_global/cmath: Likewise.
* testsuite/26_numerics/headers/cmath/25913.cc: New.

* include/c_std/cmath (__gnu_cxx::__capture_isfinite,
__capture_isinf, __capture_isnan, __capture_isnormal,
__capture_signbit, __capture_isgreater, __capture_isgreaterequal,
__capture_isless, __capture_islessequal, __capture_islessgreater,
__capture_isunordered): Remove.
(std::isfinite, isinf, isnan, isnormal, signbit, isgreater,
isgreaterequal, isless, islessequal, islessgreater, isunordered):
Forward to the corresponding builtin.
* include/c_global/cmath: Likewise.

* include/c_global/cmath (std::atan2, pow): Guard with __enable_if.

Added:
trunk/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/c_global/cmath
trunk/libstdc++-v3/include/c_std/cmath


-- 


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2007-11-26 Thread pcarlini at suse dot de


--- Comment #8 from pcarlini at suse dot de  2007-11-26 18:26 ---
Fixed for 4.3.0.


-- 

pcarlini at suse dot de changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.3.0


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2007-11-26 Thread pcarlini at suse dot de


-- 

pcarlini at suse dot de changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
   |dot org |
 Status|NEW |ASSIGNED


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-23 Thread pinskia at gcc dot gnu dot org


--- Comment #6 from pinskia at gcc dot gnu dot org  2006-01-23 14:50 ---
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2006-01-23 14:50:10
   date||


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-22 Thread gdr at cs dot tamu dot edu


--- Comment #1 from gdr at cs dot tamu dot edu  2006-01-22 20:10 ---
Subject: Re:   New: Client's isnormal function is broken by cmath

hhinnant at apple dot com [EMAIL PROTECTED] writes:

| I believe the program below should compile:

Does the problem exist if you configure with --disable-c99?

-- Gaby


-- 


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-22 Thread hhinnant at apple dot com


--- Comment #2 from hhinnant at apple dot com  2006-01-22 20:25 ---
(In reply to comment #1)
 
 Does the problem exist if you configure with --disable-c99?

I haven't tried that configuration.  The docs say that setting may change
libstdc++'s ABI.

So this is expected behavior for the default configuration?


-- 


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-22 Thread gdr at cs dot tamu dot edu


--- Comment #3 from gdr at cs dot tamu dot edu  2006-01-22 20:42 ---
Subject: Re:  Client's isnormal function is broken by cmath

hhinnant at apple dot com [EMAIL PROTECTED] writes:

| (In reply to comment #1)
|  
|  Does the problem exist if you configure with --disable-c99?
| 
| I haven't tried that configuration.  The docs say that setting may change
| libstdc++'s ABI.

Indeed.  The question was to what extent the issue is completely fixable.

| So this is expected behavior for the default configuration?

if you keep ADL and template deduction, sort of :-)

This is the error I get:

/home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:
In function 'int __gnu_cxx::__capture_isnormal(_Tp) [with _Tp =
manager]':
/home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:537:
instantiated from 'int std::isnormal(_Tp) [with _Tp = manager]'
t.C:22:   instantiated from here
/home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466:
error: cannot convert 'manager' to 'long double' for argument '1' to 'int
__fpclassifyl(long double)'
/home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466:
error: cannot convert 'manager' to 'double' for argument '1' to 'int
__fpclassify(double)'
/home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466:
error: cannot convert 'manager' to 'float' for argument '1' to 'int
__fpclassifyf(float)'


which shows that std::isnormal is being used -- because it provides a
better match.  Two issues here:

  (1) the std::isnormal template is way too liberal -- probably needs
  an enable-if decoration.

  (2)  std::isnormal is there only if C99 is enabled with a
   compbination of C99 macro dynamic.  See the contrived logic in 
   std_cmath.h.

  (3) even when isnormal is enable-if hacked, you still potentially
  run into the same problem.

-- Gaby


-- 


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-22 Thread hhinnant at apple dot com


--- Comment #4 from hhinnant at apple dot com  2006-01-22 20:49 ---
(In reply to comment #3)

   (3) even when isnormal is enable-if hacked, you still potentially
   run into the same problem.

For example?


-- 


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



[Bug libstdc++/25913] Client's isnormal function is broken by cmath

2006-01-22 Thread gdr at cs dot tamu dot edu


--- Comment #5 from gdr at cs dot tamu dot edu  2006-01-22 21:17 ---
Subject: Re:  Client's isnormal function is broken by cmath

hhinnant at apple dot com [EMAIL PROTECTED] writes:

| (In reply to comment #3)
| 
|(3) even when isnormal is enable-if hacked, you still potentially
|run into the same problem.
| 
| For example?

Plain #include math.h

-- Gaby


-- 


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