public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
@ 2004-08-15 22:38 carlo at gcc dot gnu dot org
  2004-08-15 22:54 ` [Bug c++/17041] [3.5 regression] " bangerth at dealii dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-08-15 22:38 UTC (permalink / raw)
  To: gcc-bugs

The current CVS (20040813) gives a wrong warning that the compiler
never gave before.

>g++-cvs-3.5 -Wall -v -c test.cc
Reading specs from /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/specs
Configured with: /usr/src/gcc/gcc-cvs-3.5/configure
--prefix=/usr/local/gcc-cvs-3.5 --enable-shared --with-gnu-as --with-gnu-ld
--enable-languages=c++ --enable-debug --enable-threads=posix --disable-checking
--with-system-zlib --enable-__cxa_atexit --host=i686-redhat-linux
Thread model: posix
gcc version 3.5.0 20040813 (experimental)
 /usr/src/GNU/install/bin/../libexec/gcc/i686-redhat-linux/3.5.0/cc1plus -quiet
-v -iprefix /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/
-D_GNU_SOURCE test.cc -quiet -dumpbase test.cc -mtune=pentiumpro -auxbase test
-Wall -version -o /tmp/ccVItywf.s
ignoring nonexistent directory
"/usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/../../../../i686-redhat-linux/include"
ignoring duplicate directory
"/usr/local/gcc-cvs-3.5/lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0"
ignoring duplicate directory
"/usr/local/gcc-cvs-3.5/lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0/i686-redhat-linux"
ignoring duplicate directory
"/usr/local/gcc-cvs-3.5/lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0/backward"
ignoring duplicate directory
"/usr/local/gcc-cvs-3.5/lib/gcc/i686-redhat-linux/3.5.0/include"
ignoring nonexistent directory
"/usr/local/gcc-cvs-3.5/lib/gcc/i686-redhat-linux/3.5.0/../../../../i686-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0
 /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0/i686-redhat-linux
 /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/../../../../include/c++/3.5.0/backward
 /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/include
 /usr/local/include
 /usr/local/gcc-cvs-3.5/include
 /usr/include
End of search list.
GNU C++ version 3.5.0 20040813 (experimental) (i686-redhat-linux)
        compiled by GNU C version 3.5.0 20040813 (experimental).
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113141
test.cc: In member function `void A<T>::f() [with T = int]':
test.cc:14:   instantiated from here
test.cc:6: warning: suggest parentheses around assignment used as truth value
 as -V -Qy -o test.o /tmp/ccVItywf.s
GNU assembler version 2.14.90.0.8 (i386-redhat-linux) using BFD version
2.14.90.0.8 20040114

Where 'test.cc' is:

>cat test.cc
template<typename T>
  struct A {
    void f()
    {
      int i;
      if ((i = 0))   // LINE 6
        return;
    }
  };

void g()
{
  A<int> a;
  a.f();
}

-- 
           Summary: [regression 3.5] Erroneous "suggest parentheses around
                    assignment used as truth value" warning in template
                    members.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
@ 2004-08-15 22:54 ` bangerth at dealii dot org
  2004-08-16 17:37 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-08-15 22:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-15 22:54 -------
True -- the parentheses are already there, how many more does the compiler 
want? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.5.0
      Known to work|                            |3.4.1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-15 22:54:38
               date|                            |
            Summary|[regression 3.5] Erroneous  |[3.5 regression] Erroneous
                   |"suggest parentheses around |"suggest parentheses around
                   |assignment used as truth    |assignment used as truth
                   |value" warning in template  |value" warning in template
                   |members.                    |members.
   Target Milestone|---                         |3.5.0


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
  2004-08-15 22:54 ` [Bug c++/17041] [3.5 regression] " bangerth at dealii dot org
@ 2004-08-16 17:37 ` pinskia at gcc dot gnu dot org
  2004-08-17 15:00 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-16 17:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-16 17:37 -------
: Search converges between 2004-07-19-trunk (#490) and 2004-07-20-trunk (#491).

-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
  2004-08-15 22:54 ` [Bug c++/17041] [3.5 regression] " bangerth at dealii dot org
  2004-08-16 17:37 ` pinskia at gcc dot gnu dot org
@ 2004-08-17 15:00 ` reichelt at gcc dot gnu dot org
  2004-08-17 15:25 ` jsm at polyomino dot org dot uk
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-17 15:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-17 15:00 -------
Jason, your patch
  http://gcc.gnu.org/ml/gcc-cvs/2004-07/msg00990.html
seems to be responsible for the regression.

Could you please have a look?

Btw, here's an even shorter testcase:

====================================================
template<int> struct A
{
    int i;
    A() { if ((i = 0)) ; }
};

A<0> a;
====================================================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot
                   |                            |org, reichelt at gcc dot gnu
                   |                            |dot org
           Severity|normal                      |critical
           Keywords|                            |monitored


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-08-17 15:00 ` reichelt at gcc dot gnu dot org
@ 2004-08-17 15:25 ` jsm at polyomino dot org dot uk
  2004-08-17 15:31 ` reichelt at igpm dot rwth-aachen dot de
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-08-17 15:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-08-17 15:25 -------
Subject: Re:  [3.5 regression] Erroneous "suggest parentheses
 around assignment used as truth value" warning in template members.

On Tue, 17 Aug 2004, reichelt at gcc dot gnu dot org wrote:

>   http://gcc.gnu.org/ml/gcc-cvs/2004-07/msg00990.html
> seems to be responsible for the regression.
> 
> Could you please have a look?
> 
> Btw, here's an even shorter testcase:
> 
> ====================================================
> template<int> struct A
> {
>     int i;
>     A() { if ((i = 0)) ; }
> };
> 
> A<0> a;
> ====================================================

I take it then that this works (i.e. doesn't warn) in 3.3.x or earlier, 
for it to be a regression?  Since this warning was *completely* broken 
(i.e. never warning even when it should) in 3.4.x as it hadn't been 
reimplemented for the new parser.



-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-08-17 15:25 ` jsm at polyomino dot org dot uk
@ 2004-08-17 15:31 ` reichelt at igpm dot rwth-aachen dot de
  2004-08-17 15:33 ` carlo at alinoe dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at igpm dot rwth-aachen dot de @ 2004-08-17 15:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at igpm dot rwth-aachen dot de  2004-08-17 15:31 -------
Subject: Re:  [3.5 regression] Erroneous
 "suggest parentheses around assignment used as truth value" warning in
 template members.

On 17 Aug, jsm at polyomino dot org dot uk wrote:
> I take it then that this works (i.e. doesn't warn) in 3.3.x or earlier, 
> for it to be a regression?  Since this warning was *completely* broken 
> (i.e. never warning even when it should) in 3.4.x as it hadn't been 
> reimplemented for the new parser.

All compilers from (at least) 2.95.3 up to and including 3.4.1 correctly
do not issue a warning for the testcase.




-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-08-17 15:31 ` reichelt at igpm dot rwth-aachen dot de
@ 2004-08-17 15:33 ` carlo at alinoe dot com
  2004-08-17 18:23 ` jsm at polyomino dot org dot uk
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: carlo at alinoe dot com @ 2004-08-17 15:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at alinoe dot com  2004-08-17 15:33 -------
Subject: Re:  [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.

On Tue, Aug 17, 2004 at 03:25:47PM -0000, jsm at polyomino dot org dot uk wrote:
> I take it then that this works (i.e. doesn't warn) in 3.3.x or earlier, 
> for it to be a regression?  Since this warning was *completely* broken 
> (i.e. never warning even when it should) in 3.4.x as it hadn't been 
> reimplemented for the new parser.

Not sure for the testcases - but yes.  I compile my libraries with
3.3.3 too - and use -Wall -Werror.  I never ran into this before.
It is a totally new regression in the sense that code that has
compiled fine for a long time suddenly stopped compiling.



-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-08-17 15:33 ` carlo at alinoe dot com
@ 2004-08-17 18:23 ` jsm at polyomino dot org dot uk
  2004-08-19  8:02 ` cvs-commit at gcc dot gnu dot org
  2004-08-19 14:09 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-08-17 18:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-08-17 18:23 -------
Subject: Re:  [3.5 regression] Erroneous "suggest parentheses
 around assignment used as truth value" warning in template members.

I'll test a patch for this tomorrow.



-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-08-17 18:23 ` jsm at polyomino dot org dot uk
@ 2004-08-19  8:02 ` cvs-commit at gcc dot gnu dot org
  2004-08-19 14:09 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-19  8:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-19 08:01 -------
Subject: Bug 17041

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2004-08-19 08:01:50

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: Wparentheses-3.C 

Log message:
	PR c++/17041
	* pt.c (tsubst_copy, tsubst_copy_and_build): Copy TREE_NO_WARNING
	from input for MODOP_EXPR.
	
	testsuite:
	* g++.dg/Wparentheses-3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4283&r2=1.4284
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.909&r2=1.910
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4157&r2=1.4158
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wparentheses-3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/17041] [3.5 regression] Erroneous "suggest parentheses around assignment used as truth value" warning in template members.
  2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-08-19  8:02 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-19 14:09 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-19 14:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-19 14:09 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-08-19 14:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-15 22:38 [Bug c++/17041] New: [regression 3.5] Erroneous "suggest parentheses around assignment used as truth value" warning in template members carlo at gcc dot gnu dot org
2004-08-15 22:54 ` [Bug c++/17041] [3.5 regression] " bangerth at dealii dot org
2004-08-16 17:37 ` pinskia at gcc dot gnu dot org
2004-08-17 15:00 ` reichelt at gcc dot gnu dot org
2004-08-17 15:25 ` jsm at polyomino dot org dot uk
2004-08-17 15:31 ` reichelt at igpm dot rwth-aachen dot de
2004-08-17 15:33 ` carlo at alinoe dot com
2004-08-17 18:23 ` jsm at polyomino dot org dot uk
2004-08-19  8:02 ` cvs-commit at gcc dot gnu dot org
2004-08-19 14:09 ` 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).