public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11512] New: Wrong warning in trivial function template
@ 2003-07-13 13:32 jan at etpmod dot phys dot tue dot nl
2003-07-13 14:32 ` [Bug c++/11512] [3.4 Regression]Wrong " pinskia at physics dot uc dot edu
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: jan at etpmod dot phys dot tue dot nl @ 2003-07-13 13:32 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
Summary: Wrong warning in trivial function template
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan at etpmod dot phys dot tue dot nl
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: linux, glibc-2.2.5
GCC host triplet: linux, glibc-2.2.5
GCC target triplet: linux, glibc-2.2.5
Consider the following code. When compiling with -Wall it generates:
comma.cpp: In function `int foo2()':
comma.cpp:15: warning: left-hand operand of comma expression has no effect
The 'identical' template-less function (foo1) compiles without warnings. Obviously this warning
is wrong, and both versions of the code give the expected result.
#include <cassert>
int foo1()
{
int r=0;
for (int i=0; i<1; ++i, ++r)
;
return r;
}
template <class T>
int foo2()
{
int r=0;
for (int i=0; i<1; ++i, ++r)
;
return r;
}
int main()
{
assert(foo1()==1);
assert(foo2<int>()==1);
return 0;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression]Wrong warning in trivial function template
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
@ 2003-07-13 14:32 ` pinskia at physics dot uc dot edu
2003-07-25 12:55 ` nathan at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-13 14:32 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC target triplet|linux, glibc-2.2.5 |*-*-*
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2003-07-13 14:32:40
date| |
Summary|Wrong warning in trivial |[3.4 Regression]Wrong
|function template |warning in trivial function
| |template
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-13 14:32 -------
I can confirm this on the mainline (20030711). It does not warn in 3.3.1 (20030707).
>From Phil Regression hunter: Search converges between 2003-04-11-trunk (#205) and
2003-04-12-trunk (#206) .
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression]Wrong warning in trivial function template
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
2003-07-13 14:32 ` [Bug c++/11512] [3.4 Regression]Wrong " pinskia at physics dot uc dot edu
@ 2003-07-25 12:55 ` nathan at gcc dot gnu dot org
2003-07-26 23:26 ` pinskia at physics dot uc dot edu
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-07-25 12:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
nathan at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |nathan at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression]Wrong warning in trivial function template
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
2003-07-13 14:32 ` [Bug c++/11512] [3.4 Regression]Wrong " pinskia at physics dot uc dot edu
2003-07-25 12:55 ` nathan at gcc dot gnu dot org
@ 2003-07-26 23:26 ` pinskia at physics dot uc dot edu
2003-08-06 14:46 ` [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates pinskia at physics dot uc dot edu
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-26 23:26 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |weiss at sztaki dot hu
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-26 23:26 -------
*** Bug 11677 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (3 preceding siblings ...)
2003-08-06 14:46 ` [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates pinskia at physics dot uc dot edu
@ 2003-08-06 14:46 ` pinskia at physics dot uc dot edu
2003-08-06 23:30 ` janis187 at us dot ibm dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 14:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-06 14:46 -------
*** Bug 11833 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (2 preceding siblings ...)
2003-07-26 23:26 ` pinskia at physics dot uc dot edu
@ 2003-08-06 14:46 ` pinskia at physics dot uc dot edu
2003-08-06 14:46 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 14:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.4 Regression]Wrong |[3.4 Regression] Spurious
|warning in trivial function |warning for comma-operator
|template |in templates
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-06 14:46 -------
Fix summary so that people will not file dups of this one.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (4 preceding siblings ...)
2003-08-06 14:46 ` pinskia at physics dot uc dot edu
@ 2003-08-06 23:30 ` janis187 at us dot ibm dot com
2003-08-06 23:42 ` pinskia at physics dot uc dot edu
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-08-06 23:30 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
janis187 at us dot ibm dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
------- Additional Comments From janis187 at us dot ibm dot com 2003-08-06 23:30 -------
The regression in PR 11512 was introduced or exposed by this patch:
--- gcc/gcc/ChangeLog ---
2003-07-08 Mark Mitchell <mark@codesourcery.com>
* fold-const.c (make_range): Do not access operand 1 for a
zero-operand operator.
--- gcc/gcc/cp/ChangeLog ---
2003-07-08 Mark Mitchell <mark@codesourcery.com>
* cp-tree.def (NON_DEPENDENT_EXPR): New node.
* cp-tree.h (build_call_from_tree): Remove.
(build_member_call): Likewise.
[lots more]
At least, that's what my regression hunt came up with on
i686-pc-linux-gnu using the submitter's test case with -Wall, but it
doesn't fit with the date range that Andrew reported in comment #1.
If this looks inconsistent, let me know and I'll test a series of
compilers to see if it's an intermittent bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (5 preceding siblings ...)
2003-08-06 23:30 ` janis187 at us dot ibm dot com
@ 2003-08-06 23:42 ` pinskia at physics dot uc dot edu
2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-06 23:42 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-06 23:42 -------
With Phil's regression hunter today, I now get: Search converges between 2003-07-08-trunk
(#337) and 2003-07-09-trunk (#338). which corresponds to what Janis gets but I also tried with
limiting to just between 2003-04-11 and 2003-04-12 it returns it fails so something is wrong
because there is no warning at all; I do not know if it is Phil's regression hunter or gcc just rejected
this at that point.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (6 preceding siblings ...)
2003-08-06 23:42 ` pinskia at physics dot uc dot edu
@ 2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
2003-08-16 13:31 ` nathan at gcc dot gnu dot org
2003-08-16 13:32 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-16 12:43 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gerald at pfeifer dot com
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-16 12:43 -------
*** Bug 11945 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (7 preceding siblings ...)
2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
@ 2003-08-16 13:31 ` nathan at gcc dot gnu dot org
2003-08-16 13:32 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-08-16 13:31 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
nathan at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From nathan at gcc dot gnu dot org 2003-08-16 13:31 -------
2003-08-16 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11512
* stmt.c (expand_expr_stmt_value): Don't warn about any void
typed expression.
2003-08-16 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11512
* cvt.c (convert_to_void): Indicate which side of conditional has
no effects, and rhs of comma operator. Test for no sideeffect
expressions here and always build a convert expr.
* init.c (expand_default_init): Convert the init to void.
* typeck.c (build_x_compound_expr): Do not check for side effects
here.
(build_compound_expr): Do not convert lhs when building a
template.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
` (8 preceding siblings ...)
2003-08-16 13:31 ` nathan at gcc dot gnu dot org
@ 2003-08-16 13:32 ` cvs-commit at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-08-16 13:32 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11512
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-08-16 13:32 -------
Subject: Bug 11512
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: nathan@gcc.gnu.org 2003-08-16 13:32:12
Modified files:
gcc : stmt.c ChangeLog
gcc/cp : ChangeLog cvt.c init.c typeck.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: warn1.C
Log message:
PR c++/11512
* stmt.c (expand_expr_stmt_value): Don't warn about any void
typed expression.
cp:
PR c++/11512
* cvt.c (convert_to_void): Indicate which side of conditional has
no effects, and rhs of comma operator. Test for no sideeffect
expressions here and always build a convert expr.
* init.c (expand_default_init): Convert the init to void.
* typeck.c (build_x_compound_expr): Do not check for side effects
here.
(build_compound_expr): Do not convert lhs when building a
template.
testsuite:
PR C++/11512
* g++.dg/template/warn1.C: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.324&r2=1.325
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.787&r2=2.788
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3603&r2=1.3604
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&r1=1.143&r2=1.144
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.337&r2=1.338
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.492&r2=1.493
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2972&r2=1.2973
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/warn1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-08-16 13:32 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-13 13:32 [Bug c++/11512] New: Wrong warning in trivial function template jan at etpmod dot phys dot tue dot nl
2003-07-13 14:32 ` [Bug c++/11512] [3.4 Regression]Wrong " pinskia at physics dot uc dot edu
2003-07-25 12:55 ` nathan at gcc dot gnu dot org
2003-07-26 23:26 ` pinskia at physics dot uc dot edu
2003-08-06 14:46 ` [Bug c++/11512] [3.4 Regression] Spurious warning for comma-operator in templates pinskia at physics dot uc dot edu
2003-08-06 14:46 ` pinskia at physics dot uc dot edu
2003-08-06 23:30 ` janis187 at us dot ibm dot com
2003-08-06 23:42 ` pinskia at physics dot uc dot edu
2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
2003-08-16 13:31 ` nathan at gcc dot gnu dot org
2003-08-16 13:32 ` 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).