* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
@ 2005-08-29 2:57 ` pinskia at gcc dot gnu dot org
2005-08-29 22:50 ` br1 at internet dot com dot uy
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-29 2:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-29 02:34 -------
ic by the C++ standard does not need to propagate its value into ic < 5u so I think the warning is
warranted.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
2005-08-29 2:57 ` [Bug c++/23608] " pinskia at gcc dot gnu dot org
@ 2005-08-29 22:50 ` br1 at internet dot com dot uy
2005-08-29 23:01 ` Andrew Pinski
2005-08-29 23:10 ` pinskia at physics dot uc dot edu
` (3 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: br1 at internet dot com dot uy @ 2005-08-29 22:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From br1 at internet dot com dot uy 2005-08-29 22:24 -------
Could you point me to the section in the standard? I thought warning were a
quality of implementation matter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 22:50 ` br1 at internet dot com dot uy
@ 2005-08-29 23:01 ` Andrew Pinski
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Pinski @ 2005-08-29 23:01 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
On Aug 29, 2005, at 6:24 PM, br1 at internet dot com dot uy wrote:
>
> ------- Additional Comments From br1 at internet dot com dot uy
> 2005-08-29 22:24 -------
> Could you point me to the section in the standard? I thought warning
> were a
> quality of implementation matter.
No you misunderstood me. What I was trying to say the const propagation
does not need to happen. Since that is the case the warning is still
valid.
-- Pinski
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
2005-08-29 2:57 ` [Bug c++/23608] " pinskia at gcc dot gnu dot org
2005-08-29 22:50 ` br1 at internet dot com dot uy
@ 2005-08-29 23:10 ` pinskia at physics dot uc dot edu
2005-08-29 23:19 ` bangerth at dealii dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2005-08-29 23:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at physics dot uc dot edu 2005-08-29 23:01 -------
Subject: Re: -Wsign-compare and const propagation
On Aug 29, 2005, at 6:24 PM, br1 at internet dot com dot uy wrote:
>
> ------- Additional Comments From br1 at internet dot com dot uy
> 2005-08-29 22:24 -------
> Could you point me to the section in the standard? I thought warning
> were a
> quality of implementation matter.
No you misunderstood me. What I was trying to say the const propagation
does not need to happen. Since that is the case the warning is still
valid.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
` (2 preceding siblings ...)
2005-08-29 23:10 ` pinskia at physics dot uc dot edu
@ 2005-08-29 23:19 ` bangerth at dealii dot org
2005-08-30 0:11 ` br1 at internet dot com dot uy
2005-08-30 0:35 ` gdr at integrable-solutions dot net
5 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2005-08-29 23:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-08-29 23:10 -------
What Andrew is trying to say is that in C, even variables that are marked
'const' can be modified. Thus, the compiler can't (naively, i.e. without
using flow analysis) determine that 'i' or 'ic' have the value 5, and
therefore warn that there is a comparison between signed and unsigned.
However, in the last line, the compiler knows the value that is being
compared to 5u and sees that nothing bad can happen here. It therefore
does not warn.
In C++, the situation is different, since const variables can't be changed.
The compiler could therefore be able to determine that the second comparison
does not warrant a warning. This notwithstanding, the compiler doesn't do
this right now.
As annoying as this is, I don't consider this a bug. It may be classified
as an enhancement, though, if someone wants to make this warning contigent
upon the availability of forward propagation of values. General consensus
has been, however, not to do this.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Priority|P2 |P3
Last reconfirmed|0000-00-00 00:00:00 |2005-08-29 23:10:37
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
` (3 preceding siblings ...)
2005-08-29 23:19 ` bangerth at dealii dot org
@ 2005-08-30 0:11 ` br1 at internet dot com dot uy
2005-08-30 0:35 ` gdr at integrable-solutions dot net
5 siblings, 0 replies; 8+ messages in thread
From: br1 at internet dot com dot uy @ 2005-08-30 0:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From br1 at internet dot com dot uy 2005-08-29 23:23 -------
I don't know much about const in C, just C++. I just wanted to have this
request entered in your database, as a possible enhancement, of course.
Regards,
Bruno
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/23608] -Wsign-compare and const propagation
2005-08-29 2:34 [Bug c++/23608] New: -Wsign-compare and const propagation br1 at internet dot com dot uy
` (4 preceding siblings ...)
2005-08-30 0:11 ` br1 at internet dot com dot uy
@ 2005-08-30 0:35 ` gdr at integrable-solutions dot net
5 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-08-30 0:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-08-30 00:09 -------
Subject: Re: -Wsign-compare and const propagation
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| As annoying as this is, I don't consider this a bug. It may be classified
| as an enhancement, though, if someone wants to make this warning contigent
| upon the availability of forward propagation of values. General consensus
| has been, however, not to do this.
I agree with Wolfgang's clear analysis.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608
^ permalink raw reply [flat|nested] 8+ messages in thread