public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
@ 2006-01-21 20:38 ` pinskia at gcc dot gnu dot org
  2006-01-23  1:17 ` gdr at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-21 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-01-21 20:38 -------
-Wno-always-true does NOT disable this warning.


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
  2006-01-21 20:38 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
@ 2006-01-23  1:17 ` gdr at gcc dot gnu dot org
  2006-01-23  1:23 ` gdr at cs dot tamu dot edu
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at gcc dot gnu dot org @ 2006-01-23  1:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from gdr at gcc dot gnu dot org  2006-01-23 01:17 -------

> > With this code:
> > template <typename t>
> > void f(t c) {
> >   assert(0 <= c and c <= 2);
> > }
> > int main() {
> >   f<unsigned char>(5);
> > }
> > I only get a warning on instantiation.
> > 
> >
> 
> I see, I oversimplified the problem a bit. Here is a better example:
> ------------------------------
> #include <cassert>
> template <typename Int, Int D>
> void f(Int x) {
>   assert(0 <= x and x <= D);
> }

This kind of template tends to be common place for certain catgories
of codes.  It is annoying.  This also manifests in gcjx.  
I don't know which way to go yet, but certainly it should be
controlable by -Walways-true.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org, gdr at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
  2006-01-21 20:38 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
  2006-01-23  1:17 ` gdr at gcc dot gnu dot org
@ 2006-01-23  1:23 ` gdr at cs dot tamu dot edu
  2007-01-09 14:36 ` manu at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at cs dot tamu dot edu @ 2006-01-23  1:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from gdr at cs dot tamu dot edu  2006-01-23 01:23 -------
Subject: Re:  unsigned warning in template

"gdr at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| > I see, I oversimplified the problem a bit. Here is a better example:
| > ------------------------------
| > #include <cassert>
| > template <typename Int, Int D>
| > void f(Int x) {
| >   assert(0 <= x and x <= D);
| > }
| 
| This kind of template tends to be common place for certain catgories
| of codes.  It is annoying.

To be clear, "it" is not the template, "it" is the warning in case
there is a doubt :-)

-- Gaby


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-01-23  1:23 ` gdr at cs dot tamu dot edu
@ 2007-01-09 14:36 ` manu at gcc dot gnu dot org
  2007-01-17  0:47 ` manu at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-09 14:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from manu at gcc dot gnu dot org  2007-01-09 14:36 -------
This seems similar to PR 12963. I am preparing a patch for this


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-01-15 21:05:57         |2007-01-09 14:36:09
               date|                            |


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-01-09 14:36 ` manu at gcc dot gnu dot org
@ 2007-01-17  0:47 ` manu at gcc dot gnu dot org
  2007-01-17  0:59 ` gdr at cs dot tamu dot edu
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-17  0:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from manu at gcc dot gnu dot org  2007-01-17 00:47 -------
#include <cassert>
template <typename Int, Int D>
void f(Int x) {
  assert(0 <= x and x <= D);
}
int main() {
  f<unsigned char, 2>(5);
  f<signed char, 2>(5);
}


We don't emit a warning when instantiated as a signed char, so everything boils
down to having an option to disable the warning, doesn't it?

There is a patch pending review for that:
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01120.html


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2007-01-17  0:47 ` manu at gcc dot gnu dot org
@ 2007-01-17  0:59 ` gdr at cs dot tamu dot edu
  2007-01-17  1:11 ` manu at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-17  0:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from gdr at cs dot tamu dot edu  2007-01-17 00:59 -------
Subject: Re:  unsigned warning in template

"manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| #include <cassert>
| template <typename Int, Int D>
| void f(Int x) {
|   assert(0 <= x and x <= D);
| }
| int main() {
|   f<unsigned char, 2>(5);
|   f<signed char, 2>(5);
| }
| 
| 
| We don't emit a warning when instantiated as a signed char, so everything
boils
| down to having an option to disable the warning, doesn't it?

the logical inference escapes me.

-- Gaby


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2007-01-17  0:59 ` gdr at cs dot tamu dot edu
@ 2007-01-17  1:11 ` manu at gcc dot gnu dot org
  2007-01-17  1:30 ` gdr at cs dot tamu dot edu
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-17  1:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from manu at gcc dot gnu dot org  2007-01-17 01:11 -------
(In reply to comment #14)
> | We don't emit a warning when instantiated as a signed char, so everything
> boils
> | down to having an option to disable the warning, doesn't it?
> 
> the logical inference escapes me.
> 

Is having an option to disable the warning the right fix for this PR or is it
not?

If it is, there is a patch pending review.
If it is not, could you explain what would be the correct behaviour?

Thanks.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|manu at gcc dot gnu dot org |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2007-01-17  1:11 ` manu at gcc dot gnu dot org
@ 2007-01-17  1:30 ` gdr at cs dot tamu dot edu
  2007-01-17  1:33 ` tromey at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-17  1:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from gdr at cs dot tamu dot edu  2007-01-17 01:30 -------
Subject: Re:  unsigned warning in template

"manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| (In reply to comment #14)
| > | We don't emit a warning when instantiated as a signed char, so everything
| > boils
| > | down to having an option to disable the warning, doesn't it?
| > 
| > the logical inference escapes me.
| > 
| 
| Is having an option to disable the warning the right fix for this PR or is it
| not?

You made an inference in an earlier message, and I would like to
understand it.  Because, I do not believe a nobe in form
of "hey, you can silence it with with sledge-hammer" is the solution to this
particular type of constructs -- note that constants are involved.

Care to explain further your earlier message?

-- Gaby


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2007-01-17  1:30 ` gdr at cs dot tamu dot edu
@ 2007-01-17  1:33 ` tromey at gcc dot gnu dot org
  2007-01-17  1:46 ` gdr at cs dot tamu dot edu
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-17  1:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from tromey at gcc dot gnu dot org  2007-01-17 01:32 -------
A flag to control the warning does not provide
fine enough granularity of control.  That is, sometimes
the warning is appropriate, and disabling the warning
would let through code that you would prefer not to let through.

One idea would be to disable the warning if the expression involves
types which came from a template instantiation (sorry, I don't know
the C++ terminology for this).

This at least would suitably solve the case I ran into while
writing gcjx.


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2007-01-17  1:33 ` tromey at gcc dot gnu dot org
@ 2007-01-17  1:46 ` gdr at cs dot tamu dot edu
  2007-01-17  3:49 ` manu at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-17  1:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from gdr at cs dot tamu dot edu  2007-01-17 01:46 -------
Subject: Re:  unsigned warning in template

"tromey at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| A flag to control the warning does not provide
| fine enough granularity of control.

Indeed.

|  That is, sometimes
| the warning is appropriate, and disabling the warning
| would let through code that you would prefer not to let through.

Indeed.

The particularity of this PR is that it involves only constants.
It that case, the compiler should just elide the warning.  That would
be a first order approximation of a solution to this issue.

| One idea would be to disable the warning if the expression involves
| types which came from a template instantiation (sorry, I don't know
| the C++ terminology for this).

Please, don't sorry about the terminology.  The particularity of such
expressions is that they are constants.  And I would like we solve
this not just for template arguments, but of such comparaison
involving constants.  

Tom, what do you think?

-- Gaby


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2007-01-17  1:46 ` gdr at cs dot tamu dot edu
@ 2007-01-17  3:49 ` manu at gcc dot gnu dot org
  2007-01-17 12:32 ` tromey at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-17  3:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from manu at gcc dot gnu dot org  2007-01-17 03:49 -------

(In reply to comment #16)
> Subject: Re:  unsigned warning in template
> 
> "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> 
> | (In reply to comment #14)
> | > | We don't emit a warning when instantiated as a signed char, so everything
> | > boils
> | > | down to having an option to disable the warning, doesn't it?
> | > 
> | > the logical inference escapes me.
> | > 
> | 
> | Is having an option to disable the warning the right fix for this PR or is it
> | not?
> 
> You made an inference in an earlier message, and I would like to
> understand it.  Because, I do not believe a nobe in form
> of "hey, you can silence it with with sledge-hammer" is the solution to this
> particular type of constructs -- note that constants are involved.
> 
> Care to explain further your earlier message?
> 

Of course. I was reflecting on the fact that we don't warn when the template is
instantiated as signed int. Also, we don't warn for template parameters:

template <typename Int, Int D>
void g(void) {
  assert(0 <= D);
}
int gg(void) {
  g<unsigned char, 2>();
}


However, those are different from the template testcase discussed here. Yet,
since the comparison in the template testcase seems to me as constant as in
this case:

#include <cassert> 
void f(unsigned char c) { 
  assert(0 <= c and c <= 2); 
} 
int main() { 
  f(5); 
} 

and as far as I know front-ends cannot do dataflow solving, I wrongly concluded
that there was nothing else we could do. If you have a solution in mind, that
is great! I hope you manage to find time to implement it. Being able to know
the value of c would be very useful for many other warnings, -Wconversion in
particular, so I will learn a lot from your patch.

Nonetheless, having an individual option -Wcomparison-fixed to enabled/disable
this unnamed warning seems worthwhile by itself and it is also useful as a
temporary work-around while you are working in your patch.

Also, the same patch will close PR 23587 and PR 12963 and come closer to fix PR
7651. 

We can keep this PR open until your patch is committed.


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2007-01-17  3:49 ` manu at gcc dot gnu dot org
@ 2007-01-17 12:32 ` tromey at gcc dot gnu dot org
  2007-01-17 13:47 ` gdr at cs dot tamu dot edu
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-17 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from tromey at gcc dot gnu dot org  2007-01-17 12:32 -------
> The particularity of such expressions is that they are constants.

I've thought about this a bit but I don't have a real conclusion.

I don't know why this warning was added in the first place... it seems
like perhaps it was to deal with comparisons against constants.
For instance comparing "unsigned < 0" or what have you.  If this is the
case (and we'd have to dig a bit to find out) then that would seem to
argue against this approach.

My interest here is template-oriented... I consider it from a generic
programming point of view.  I was trying to write a certain program
in the generic style, and one particular template instantiation yielded
a warning.

One possible idea would be an expression attriute of some kind:

__do_not_warn__ (val < 0)

I'm not extremely happy with this however.


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2007-01-17 12:32 ` tromey at gcc dot gnu dot org
@ 2007-01-17 13:47 ` gdr at cs dot tamu dot edu
  2007-02-06 13:49 ` manu at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-17 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from gdr at cs dot tamu dot edu  2007-01-17 13:47 -------
Subject: Re:  unsigned warning in template

"tromey at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| > The particularity of such expressions is that they are constants.
| 
| I've thought about this a bit but I don't have a real conclusion.
| 
| I don't know why this warning was added in the first place... it seems
| like perhaps it was to deal with comparisons against constants.
| For instance comparing "unsigned < 0" or what have you.  If this is the
| case (and we'd have to dig a bit to find out) then that would seem to
| argue against this approach.

I see what you mean.  Let me think about it.

| My interest here is template-oriented... I consider it from a generic
| programming point of view.  I was trying to write a certain program
| in the generic style, and one particular template instantiation yielded
| a warning.
| 
| One possible idea would be an expression attriute of some kind:
| 
| __do_not_warn__ (val < 0)
| 
| I'm not extremely happy with this however.

neither am I.  We have introduced a warning, the usefulness
of which is questionable in this specific case; now, we would be
forced to used non-standard constructs to get out of that questionable
warning.  Something must be wrong :-)

-- Gaby


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2007-01-17 13:47 ` gdr at cs dot tamu dot edu
@ 2007-02-06 13:49 ` manu at gcc dot gnu dot org
  2007-05-20 20:34 ` manu at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-02-06 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from manu at gcc dot gnu dot org  2007-02-06 13:49 -------
Not a definitive fix but at least the warning can be disabled:
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01933.html


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2007-02-06 13:49 ` manu at gcc dot gnu dot org
@ 2007-05-20 20:34 ` manu at gcc dot gnu dot org
  2007-05-20 20:46 ` manu at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-20 20:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from manu at gcc dot gnu dot org  2007-05-20 21:32 -------
Subject: Bug 11856

Author: manu
Date: Sun May 20 20:29:55 2007
New Revision: 124875

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124875
Log:
2007-05-20  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR middle-end/7651
        PR c++/11856
        PR c/12963
        PR c/23587
        PR other/29694
        * c.opt (Wtype-limits): New.
        * doc/invoke.texi (Wtype-limits): Document it.
        (Wextra): Enabled by -Wextra.
        * c-opts.c (c_common_post_options): Enabled by -Wextra.
        * c-common.c (shorten_compare): Warn with Wtype-limits.

testsuite/
        * gcc.dg/compare6.c: Replace Wall with Wtype-limits.
        * gcc.dg/Wtype-limits.c: New.
        * gcc.dg/Wtype-limits-Wextra.c: New.
        * gcc.dg/Wtype-limits-no.c: New.
        * g++.dg/warn/Wtype-limits.C: New.
        * g++.dg/warn/Wtype-limits-Wextra.C: New.
        * g++.dg/warn/Wtype-limits-no.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits.C
    trunk/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c
    trunk/gcc/testsuite/gcc.dg/Wtype-limits-no.c
    trunk/gcc/testsuite/gcc.dg/Wtype-limits.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/compare6.c


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2007-05-20 20:34 ` manu at gcc dot gnu dot org
@ 2007-05-20 20:46 ` manu at gcc dot gnu dot org
  2008-01-14 21:29 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-20 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from manu at gcc dot gnu dot org  2007-05-20 21:46 -------
As a workaround, the warning can be disabled with -Wno-type-limits.


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2007-05-20 20:46 ` manu at gcc dot gnu dot org
@ 2008-01-14 21:29 ` pinskia at gcc dot gnu dot org
  2008-01-14 22:44 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-14 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from pinskia at gcc dot gnu dot org  2008-01-14 19:42 -------
*** Bug 34783 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at apple dot com


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (16 preceding siblings ...)
  2008-01-14 21:29 ` pinskia at gcc dot gnu dot org
@ 2008-01-14 22:44 ` pinskia at gcc dot gnu dot org
  2008-01-15  0:12 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-14 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from pinskia at gcc dot gnu dot org  2008-01-14 21:38 -------
*** Bug 34783 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (17 preceding siblings ...)
  2008-01-14 22:44 ` pinskia at gcc dot gnu dot org
@ 2008-01-15  0:12 ` manu at gcc dot gnu dot org
  2010-05-07 13:16 ` bangerth at gmail dot com
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-15  0:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from manu at gcc dot gnu dot org  2008-01-14 23:29 -------
No, this is still a bug and the last discussion about it was here:
http://gcc.gnu.org/ml/gcc/2007-11/msg00642.html


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2007-01-09 14:36:09         |2008-01-14 23:29:23
               date|                            |


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (18 preceding siblings ...)
  2008-01-15  0:12 ` manu at gcc dot gnu dot org
@ 2010-05-07 13:16 ` bangerth at gmail dot com
  2010-09-06  5:25 ` pinskia at gcc dot gnu dot org
  2010-09-06  5:39 ` pinskia at gcc dot gnu dot org
  21 siblings, 0 replies; 32+ messages in thread
From: bangerth at gmail dot com @ 2010-05-07 13:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from bangerth at gmail dot com  2010-05-07 13:15 -------
*** Bug 44021 has been marked as a duplicate of this bug. ***


-- 

bangerth at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crossroads0000 at googlemail
                   |                            |dot com


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (19 preceding siblings ...)
  2010-05-07 13:16 ` bangerth at gmail dot com
@ 2010-09-06  5:25 ` pinskia at gcc dot gnu dot org
  2010-09-06  5:39 ` pinskia at gcc dot gnu dot org
  21 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-06  5:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #29 from pinskia at gcc dot gnu dot org  2010-09-06 05:24 -------
*** Bug 45553 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |noloader at gmail dot com


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
                   ` (20 preceding siblings ...)
  2010-09-06  5:25 ` pinskia at gcc dot gnu dot org
@ 2010-09-06  5:39 ` pinskia at gcc dot gnu dot org
  21 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-06  5:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #30 from pinskia at gcc dot gnu dot org  2010-09-06 05:39 -------
*** Bug 45553 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-05-23 18:27 ` paolo.carlini at oracle dot com
@ 2013-06-06 21:39 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 32+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-06 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gpiez at web dot de

--- Comment #36 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 44811 has been marked as a duplicate of this bug. ***


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-05-15 15:22 ` paolo.carlini at oracle dot com
@ 2012-05-23 18:27 ` paolo.carlini at oracle dot com
  2013-06-06 21:39 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 32+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-23 18:27 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rikaigcc at rikai dot com

--- Comment #35 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-23 18:10:57 UTC ---
*** Bug 53462 has been marked as a duplicate of this bug. ***


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-05-14 13:10 ` paolo.carlini at oracle dot com
@ 2012-05-15 15:22 ` paolo.carlini at oracle dot com
  2012-05-23 18:27 ` paolo.carlini at oracle dot com
  2013-06-06 21:39 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 32+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-15 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #34 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-15 15:20:28 UTC ---
This is fixed in mainline in Rev. 187542 with this commit:

/cp
2012-05-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/11856
    * pt.c (tsubst_copy_and_build): Increase / decrease
    c_inhibit_evaluation_warnings around build_x_binary_op call.

/c-family
2012-05-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/11856
    * c-common.c (shorten_compare): Check c_inhibit_evaluation_warnings.

/testsuite
2012-05-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/11856
    * g++.dg/warn/Wtype-limits.C: Don't warn in templates.
    * g++.dg/warn/Wtype-limits-Wextra.C: Likewise.


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
  2012-05-14 11:33 ` manu at gcc dot gnu.org
  2012-05-14 13:09 ` jason at gcc dot gnu.org
@ 2012-05-14 13:10 ` paolo.carlini at oracle dot com
  2012-05-15 15:22 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-14 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #33 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-14 13:09:06 UTC ---
Looking into it.


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
  2012-05-14 11:33 ` manu at gcc dot gnu.org
@ 2012-05-14 13:09 ` jason at gcc dot gnu.org
  2012-05-14 13:10 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: jason at gcc dot gnu.org @ 2012-05-14 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #32 from Jason Merrill <jason at gcc dot gnu.org> 2012-05-14 12:56:09 UTC ---
Seems like another job for c_inhibit_evaluation_warnings.


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

* [Bug c++/11856] unsigned warning in template
       [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
@ 2012-05-14 11:33 ` manu at gcc dot gnu.org
  2012-05-14 13:09 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-14 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot
                   |                            |com

--- Comment #31 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-14 11:31:10 UTC ---
Still a bug. The ideal fix would be to detect that the type is dependent and
not warn. How to do this needs to be investigated. Paolo, Jason, any ideas?


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

* [Bug c++/11856] unsigned warning in template
  2003-08-08 14:25 [Bug c++/11856] New: Wrong warning regarding assert o dot kullmann at swansea dot ac dot uk
                   ` (2 preceding siblings ...)
  2003-08-23  1:12 ` dhazeghi at yahoo dot com
@ 2004-05-30 17:02 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-30 17:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-29 14:49 -------
*** Bug 15723 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


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


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

* [Bug c++/11856] unsigned warning in template
  2003-08-08 14:25 [Bug c++/11856] New: Wrong warning regarding assert o dot kullmann at swansea dot ac dot uk
  2003-08-10  2:35 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
  2003-08-10  2:36 ` pinskia at gcc dot gnu dot org
@ 2003-08-23  1:12 ` dhazeghi at yahoo dot com
  2004-05-30 17:02 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 32+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:12 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=11856


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c++/11856] unsigned warning in template
  2003-08-08 14:25 [Bug c++/11856] New: Wrong warning regarding assert o dot kullmann at swansea dot ac dot uk
  2003-08-10  2:35 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
@ 2003-08-10  2:36 ` pinskia at gcc dot gnu dot org
  2003-08-23  1:12 ` dhazeghi at yahoo dot com
  2004-05-30 17:02 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-10  2:36 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=11856



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-10 02:36 -------
I really meant unsigned >= 0 is always true.


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

* [Bug c++/11856] unsigned warning in template
  2003-08-08 14:25 [Bug c++/11856] New: Wrong warning regarding assert o dot kullmann at swansea dot ac dot uk
@ 2003-08-10  2:35 ` pinskia at gcc dot gnu dot org
  2003-08-10  2:36 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 32+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-10  2:35 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=11856


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-10 02:35:07
               date|                            |
            Summary|Wrong warning regarding     |unsigned warning in template
                   |assert                      |


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-10 02:35 -------
I can confirm this on the mainline (20030809).  I like this warning but this case looks 
maybe too over warning but the warning is still true (usigned <= 0 is always true).


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

end of thread, other threads:[~2013-06-06 21:39 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11856-781@http.gcc.gnu.org/bugzilla/>
2006-01-21 20:38 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
2006-01-23  1:17 ` gdr at gcc dot gnu dot org
2006-01-23  1:23 ` gdr at cs dot tamu dot edu
2007-01-09 14:36 ` manu at gcc dot gnu dot org
2007-01-17  0:47 ` manu at gcc dot gnu dot org
2007-01-17  0:59 ` gdr at cs dot tamu dot edu
2007-01-17  1:11 ` manu at gcc dot gnu dot org
2007-01-17  1:30 ` gdr at cs dot tamu dot edu
2007-01-17  1:33 ` tromey at gcc dot gnu dot org
2007-01-17  1:46 ` gdr at cs dot tamu dot edu
2007-01-17  3:49 ` manu at gcc dot gnu dot org
2007-01-17 12:32 ` tromey at gcc dot gnu dot org
2007-01-17 13:47 ` gdr at cs dot tamu dot edu
2007-02-06 13:49 ` manu at gcc dot gnu dot org
2007-05-20 20:34 ` manu at gcc dot gnu dot org
2007-05-20 20:46 ` manu at gcc dot gnu dot org
2008-01-14 21:29 ` pinskia at gcc dot gnu dot org
2008-01-14 22:44 ` pinskia at gcc dot gnu dot org
2008-01-15  0:12 ` manu at gcc dot gnu dot org
2010-05-07 13:16 ` bangerth at gmail dot com
2010-09-06  5:25 ` pinskia at gcc dot gnu dot org
2010-09-06  5:39 ` pinskia at gcc dot gnu dot org
     [not found] <bug-11856-4@http.gcc.gnu.org/bugzilla/>
2012-05-14 11:33 ` manu at gcc dot gnu.org
2012-05-14 13:09 ` jason at gcc dot gnu.org
2012-05-14 13:10 ` paolo.carlini at oracle dot com
2012-05-15 15:22 ` paolo.carlini at oracle dot com
2012-05-23 18:27 ` paolo.carlini at oracle dot com
2013-06-06 21:39 ` paolo.carlini at oracle dot com
2003-08-08 14:25 [Bug c++/11856] New: Wrong warning regarding assert o dot kullmann at swansea dot ac dot uk
2003-08-10  2:35 ` [Bug c++/11856] unsigned warning in template pinskia at gcc dot gnu dot org
2003-08-10  2:36 ` pinskia at gcc dot gnu dot org
2003-08-23  1:12 ` dhazeghi at yahoo dot com
2004-05-30 17:02 ` 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).