public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/17120] New: [3.5 regression] warning: suggest parentheses around assignment used as truth value
@ 2004-08-20 13:21 reichelt at gcc dot gnu dot org
  2004-08-20 13:26 ` [Bug libstdc++/17120] " reichelt at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-20 13:21 UTC (permalink / raw)
  To: gcc-bugs

This came up with Jason's recent fix for -Wparentheses (PR 17041).
Just compiling

=======================
#include<cmath>
=======================

with -Wall on mainline I get the following error message 3 times:

..../bits/cmath.tcc: In function `_Tp std::__cmath_power(_Tp, unsigned int)
[with _Tp = double]':
..../cmath:338:   instantiated from `_Tp std::__pow_helper(_Tp, int) [with _Tp =
double]'
..../cmath:353:   instantiated from here
..../bits/cmath.tcc:43: warning: suggest parentheses around assignment used as
truth value

The error message is justified, since in
gcc/libstdc++-v3/include/c_std/cmath.tcc we have:


  template<typename _Tp>
    inline _Tp
    __cmath_power(_Tp __x, unsigned int __n)
    {
      _Tp __y = __n % 2 ? __x : 1;

      while (__n >>= 1)  // line 43
        {
          __x = __x * __x;
          if (__n % 2)
            __y = __y * __x;
        }

      return __y;
    }


I'll prepare a patch soon.

-- 
           Summary: [3.5 regression] warning: suggest parentheses around
                    assignment used as truth value
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: critical
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-08-21  0:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-20 13:21 [Bug libstdc++/17120] New: [3.5 regression] warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
2004-08-20 13:26 ` [Bug libstdc++/17120] " reichelt at gcc dot gnu dot org
2004-08-20 14:13 ` [Bug c++/17120] " pcarlini at suse dot de
2004-08-20 14:14 ` pcarlini at suse dot de
2004-08-20 14:19 ` pcarlini at suse dot de
2004-08-20 14:31 ` pcarlini at suse dot de
2004-08-20 14:40 ` pcarlini at suse dot de
2004-08-20 15:05 ` reichelt at gcc dot gnu dot org
2004-08-20 15:11 ` reichelt at gcc dot gnu dot org
2004-08-20 15:36 ` pinskia at gcc dot gnu dot org
2004-08-21  0:19 ` cvs-commit at gcc dot gnu dot org
2004-08-21  0:37 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).