public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value
@ 2004-07-22 22:09 reichelt at gcc dot gnu dot org
2004-07-22 22:12 ` [Bug libstdc++/16678] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-07-22 22:09 UTC (permalink / raw)
To: gcc-bugs
Compiling the code snippet
========================================
#include<iostream>
void foo(std::istream &s)
{
int i;
s >> i;
}
========================================
with "g++ -O3 -Wall" on mainline, I get the warning:
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/locale_facets.tcc:
In member function `_InIter std::num_get<_CharT,
_InIter>::_M_extract_int(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&,
_ValueT&) const [with _ValueT = long int, _CharT = char, _InIter =
std::istreambuf_iterator<char, std::char_traits<char> >]':
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/locale_facets.tcc:693:
instantiated from `_InIter std::num_get<_CharT, _InIter>::do_get(_InIter,
_InIter, std::ios_base&, std::_Ios_Iostate&, long int&) const [with _CharT =
char, _InIter = std::istreambuf_iterator<char, std::char_traits<char> >]'
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/locale_facets.h:2014:
instantiated from `_InIter std::num_get<_CharT, _InIter>::get(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, long int&) const [with _CharT = char,
_InIter = std::istreambuf_iterator<char, std::char_traits<char> >]'
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/istream.tcc:195:
instantiated from `std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char,
_Traits = std::char_traits<char>]'
bug.cc:6: instantiated from here
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/locale_facets.tcc:537:
warning: suggest parentheses around assignment used as truth value
/Work/reichelt/GCC/FARM/gcc-3.5-20040722/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/locale_facets.tcc:580:
warning: suggest parentheses around assignment used as truth value
In fact line 580 in locale_facets.tcc reads:
else if (__q = __traits_type::find(__lit_zero, __len, __c))
Grepping with the command
egrep -nH "if \([_a-zA-Z0-9]+ = "
through mainline's sources there some more instances of such deprecated coding:
gcc/fixinc/procopen.c:95: if (pz_cmd = *pp_args,
gcc/local-alloc.c:1359: if (r1 = XEXP (note, 0), REG_P (r1)
gcc/tlink.c:605: else if (p = strchr (oldq, '"'), p)
libjava/java/lang/dtoa.c:325: if (j = 11 - hi0bits (word0 (d2) &
Frac_mask))
libjava/java/lang/mprec.c:388: if (y = *xb++)
libjava/java/lang/mprec.c:815: if (y = d1)
libjava/java/lang/mprec.c:817: if (k = lo0bits (&y))
libstdc++-v3/include/bits/locale_facets.tcc:371: else if (__q =
__traits_type::find(__lit_zero, 10, __c))
libstdc++-v3/include/bits/locale_facets.tcc:537: else if (__q =
__traits_type::find(__lit_zero, __len, __c))
libstdc++-v3/include/bits/locale_facets.tcc:580: else if (__q =
__traits_type::find(__lit_zero, __len, __c))
libstdc++-v3/include/bits/locale_facets.tcc:1123: if (__p =
char_traits<_CharT>::find(__ws, __len, __cdec))
libstdc++-v3/include/bits/locale_facets.tcc:1359: if (__q =
__traits_type::find(__lit_zero, 10, *__beg))
This should be fixed.
--
Summary: warning: suggest parentheses around assignment used as
truth value
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P2
Component: other
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=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
@ 2004-07-22 22:12 ` pinskia at gcc dot gnu dot org
2004-07-22 22:42 ` bangerth at dealii dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22 22:12 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|other |libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
2004-07-22 22:12 ` [Bug libstdc++/16678] " pinskia at gcc dot gnu dot org
@ 2004-07-22 22:42 ` bangerth at dealii dot org
2004-07-23 3:28 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-07-22 22:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-22 22:42 -------
Indeed. In particular, they should be fixed for libstdc++ since these
places can show up as warnings in user programs, just as you showed.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
2004-07-22 22:12 ` [Bug libstdc++/16678] " pinskia at gcc dot gnu dot org
2004-07-22 22:42 ` bangerth at dealii dot org
@ 2004-07-23 3:28 ` pinskia at gcc dot gnu dot org
2004-07-23 23:40 ` bkoz at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-23 3:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-23 03:27 -------
Confirmed. Some people use -Werror so this is really important to fix.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|minor |normal
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-07-23 03:27:59
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-07-23 3:28 ` pinskia at gcc dot gnu dot org
@ 2004-07-23 23:40 ` bkoz at gcc dot gnu dot org
2004-07-24 0:10 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-07-23 23:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-07-23 23:40 -------
Mine.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |bkoz at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-07-23 23:40 ` bkoz at gcc dot gnu dot org
@ 2004-07-24 0:10 ` cvs-commit at gcc dot gnu dot org
2004-07-26 21:00 ` bkoz at gcc dot gnu dot org
2005-05-26 17:59 ` cvs-commit at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-24 0:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-07-24 00:10 -------
Subject: Bug 16678
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: bkoz@gcc.gnu.org 2004-07-24 00:10:09
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: locale_facets.tcc
Log message:
2004-07-23 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/16678
* include/bits/locale_facets.tcc: Fix for -Werror.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2584&r2=1.2585
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&r1=1.195&r2=1.196
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-07-24 0:10 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-26 21:00 ` bkoz at gcc dot gnu dot org
2005-05-26 17:59 ` cvs-commit at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-07-26 21:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2004-07-26 21:00 -------
Fixed on mainline
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/16678] warning: suggest parentheses around assignment used as truth value
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-07-26 21:00 ` bkoz at gcc dot gnu dot org
@ 2005-05-26 17:59 ` cvs-commit at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-26 17:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-26 17:55 -------
Subject: Bug 16678
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-rhl-branch
Changes by: jakub@gcc.gnu.org 2005-05-26 17:55:40
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: locale_facets.tcc
Log message:
PR libstdc++/16678
* include/bits/locale_facets.tcc: Fix for -Werror.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.2224.2.77.2.24&r2=1.2224.2.77.2.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.166.2.10.2.7&r2=1.166.2.10.2.8
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16678
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-05-26 17:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22 22:09 [Bug other/16678] New: warning: suggest parentheses around assignment used as truth value reichelt at gcc dot gnu dot org
2004-07-22 22:12 ` [Bug libstdc++/16678] " pinskia at gcc dot gnu dot org
2004-07-22 22:42 ` bangerth at dealii dot org
2004-07-23 3:28 ` pinskia at gcc dot gnu dot org
2004-07-23 23:40 ` bkoz at gcc dot gnu dot org
2004-07-24 0:10 ` cvs-commit at gcc dot gnu dot org
2004-07-26 21:00 ` bkoz at gcc dot gnu dot org
2005-05-26 17:59 ` cvs-commit 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).