Re: -Wuninitialized issues

2005-11-09 Thread Jeffrey A Law
On Tue, 2005-11-08 at 21:10 -0500, Kaveh R. Ghazi wrote: > > I've put a possible patch in the metabug (24639). As I mention in > > the comments, I'm not comfortable self-approving it given my lack of > > knowledge about the option processing code and the debate over what > > we want the defaul

Re: -Wuninitialized issues

2005-11-08 Thread Kaveh R. Ghazi
> I've put a possible patch in the metabug (24639). As I mention in > the comments, I'm not comfortable self-approving it given my lack of > knowledge about the option processing code and the debate over what > we want the default -Wuninitialized behavior to be. > jeff If it helps, I withdra

Re: -Wuninitialized issues

2005-11-08 Thread Jeffrey A Law
On Wed, 2005-11-02 at 18:02 -0800, Mark Mitchell wrote: > Jeffrey A Law wrote: > > > For example, if the only use was inside an unreachable hunk of > > code, does that count as a use or not? > > Yes, the EDG front-end does this: > > [EMAIL PROTECTED]:~/tmp$ cat test.cpp > void f() { > int i; >

Re: -Wuninitialized issues

2005-11-03 Thread David Taylor
> From: Jeffrey A Law <[EMAIL PROTECTED]> > Date: Wed, 02 Nov 2005 19:17:06 -0700 > > On Wed, 2005-11-02 at 20:44 -0500, Daniel Jacobowitz wrote: > > People who use -Wall -Werror are _already_ pissed off about > > -Wuninitialized. It virtually guarantees that your build will fail on > > a new re

Re: -Wuninitialized issues

2005-11-02 Thread Daniel Jacobowitz
On Wed, Nov 02, 2005 at 07:17:06PM -0700, Jeffrey A Law wrote: > Very true, but I don't think that's an execute to generate even more > false positives for them! :-) I disagree. The point of this set of warnings is that they would be _simple_ and _consistent_. Less likely to change across releas

Re: -Wuninitialized issues

2005-11-02 Thread Daniel Jacobowitz
On Wed, Nov 02, 2005 at 05:53:49PM -0800, Joe Buck wrote: > On Wed, Nov 02, 2005 at 08:44:51PM -0500, Daniel Jacobowitz wrote: > > On Wed, Nov 02, 2005 at 05:32:51PM -0800, Joe Buck wrote: > > > On Thu, Nov 03, 2005 at 02:13:05AM +0100, Gabriel Dos Reis wrote: > > > > | Have -Wuninitialized be a ve

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 20:44 -0500, Daniel Jacobowitz wrote: > On Wed, Nov 02, 2005 at 05:32:51PM -0800, Joe Buck wrote: > > On Thu, Nov 03, 2005 at 02:13:05AM +0100, Gabriel Dos Reis wrote: > > > | Have -Wuninitialized be a very simple detector, which is either in the > > > front-ends > > > | or i

Re: -Wuninitialized issues

2005-11-02 Thread Mark Mitchell
Jeffrey A Law wrote: > For example, if the only use was inside an unreachable hunk of > code, does that count as a use or not? Yes, the EDG front-end does this: [EMAIL PROTECTED]:~/tmp$ cat test.cpp void f() { int i; if (0) i = 3; } [EMAIL PROTECTED]:~/tmp$ eccp -A test.cpp "test.cpp", l

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 16:43 -0800, Mark Mitchell wrote: > Jeff, I'm sorry you're upset; I actually think we're closer to consensus > than we've ever been before on this issue. :-) Maybe that's what's getting under my skin! Rehashing those issues where I think we do have a consensus, namely the nee

Re: -Wuninitialized issues

2005-11-02 Thread Joe Buck
On Wed, Nov 02, 2005 at 08:44:51PM -0500, Daniel Jacobowitz wrote: > On Wed, Nov 02, 2005 at 05:32:51PM -0800, Joe Buck wrote: > > On Thu, Nov 03, 2005 at 02:13:05AM +0100, Gabriel Dos Reis wrote: > > > | Have -Wuninitialized be a very simple detector, which is either in the > > > front-ends > > >

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 20:35 -0500, Kaveh R. Ghazi wrote: > > Have another option to detect variables which are set but their values > > are not used (this was in one of the -Wuninitialized bugs and has been > > asked before). The EDG front-end implements this option. > > Andrew Pinski > > The

Re: -Wuninitialized issues

2005-11-02 Thread Daniel Jacobowitz
On Wed, Nov 02, 2005 at 05:32:51PM -0800, Joe Buck wrote: > On Thu, Nov 03, 2005 at 02:13:05AM +0100, Gabriel Dos Reis wrote: > > | Have -Wuninitialized be a very simple detector, which is either in the > > front-ends > > | or in the middle-end so it could be shared (just like -Wunused). > > | Hav

Re: -Wuninitialized issues

2005-11-02 Thread Kaveh R. Ghazi
> Have another option to detect variables which are set but their values > are not used (this was in one of the -Wuninitialized bugs and has been > asked before). The EDG front-end implements this option. > Andrew Pinski The sgi compiler detects this also. I'd really like gcc to have it, but

Re: -Wuninitialized issues

2005-11-02 Thread Joe Buck
On Thu, Nov 03, 2005 at 02:13:05AM +0100, Gabriel Dos Reis wrote: > | Have -Wuninitialized be a very simple detector, which is either in the > front-ends > | or in the middle-end so it could be shared (just like -Wunused). > | Have -Wuninitialized=2, be the current -Wuninitialized. > > That is ba

Re: -Wuninitialized issues

2005-11-02 Thread Kaveh R. Ghazi
> What we're in disagreement about is whether or not that class of > warnings should be triggered by -Wuninitialized. I STRONGLY believe > that -Wuninitialized should remain as-is in its documented behavior > and that we should have a distinct switch to get the new behavior. Fine, but which o

Re: -Wuninitialized issues

2005-11-02 Thread Gabriel Dos Reis
Andrew Pinski <[EMAIL PROTECTED]> writes: | > | > Diego Novillo wrote: | > | > > Agreed 100%. My vote is to use your proposal for -Wuninitialized and have, | > > as you said, another flag that does the analysis immediately after going | > > into SSA, before any transformations are done. | >

Re: -Wuninitialized issues

2005-11-02 Thread Andrew Pinski
> > Diego Novillo wrote: > > > Agreed 100%. My vote is to use your proposal for -Wuninitialized and have, > > as you said, another flag that does the analysis immediately after going > > into SSA, before any transformations are done. > > It certainly doesn't bother me to have -Wuninitialized

Re: -Wuninitialized issues

2005-11-02 Thread Mark Mitchell
Diego Novillo wrote: > Agreed 100%. My vote is to use your proposal for -Wuninitialized and have, > as you said, another flag that does the analysis immediately after going > into SSA, before any transformations are done. It certainly doesn't bother me to have -Wuninitialized continue to mean

Re: -Wuninitialized issues

2005-11-02 Thread Diego Novillo
On Wednesday 02 November 2005 19:19, Jeffrey A Law wrote: > What we're in disagreement about is whether or not that class of > warnings should be triggered by -Wuninitialized. I STRONGLY believe > that -Wuninitialized should remain as-is in its documented behavior > and that we should have a dist

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 19:04 -0500, Kaveh R. Ghazi wrote: > > I would suggest you look at our testsuite and our PR database and > > see how many PRs we've got about false-positive warnings. Achieving > > consistency will merely increase the false-positives and as a result > > make the warning l

Re: -Wuninitialized issues

2005-11-02 Thread Kaveh R. Ghazi
> I would suggest you look at our testsuite and our PR database and > see how many PRs we've got about false-positive warnings. Achieving > consistency will merely increase the false-positives and as a result > make the warning less useful IMHO. I looked at meta-bug 24639, it refers to severa

Re: -Wuninitialized issues

2005-11-02 Thread Neil Booth
Chris Lattner wrote:- > >I think it's worth noting that we build the SSA form even when we're > >not optimizing. Which in turn with running the maybe-uninitialized > >warning code early would give you the warnings you expect without > >needing to run the optimizers. That's why I don't think we n

Re: -Wuninitialized issues

2005-11-02 Thread Chris Lattner
Bernhard R. Link wrote: * Chris Lattner <[EMAIL PROTECTED]> [051102 19:28]: Jeff Law wrote: >> I prefer consistency in warnings, regardless of optimization level. >I disagree and I think we have a significant contingency of >users that would disagree Jeff, I completely agree with you for som

Re: -Wuninitialized issues

2005-11-02 Thread Chris Lattner
On Wed, 2 Nov 2005, Jeffrey A Law wrote: Sure, running it as the first stage of the optimizers has the effect of making it have the properties I desire, without requiring the front-ends to duplicate the code. Such a feature would be great to have! I think we've all agreed it's a good feature to

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 14:19 -0500, Andrew Pinski wrote: > > > However, I'll freely admit this is just my notoriously fallible memory > > > at work here; I've not reviewed the PRs. > > Mine is as fallable as yours :-) > > All of the PRs that I could find, closed or not are in the meta-bug filed >

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 12:55 -0600, Chris Lattner wrote: > > I think it's worth noting that we build the SSA form even when we're > > not optimizing. Which in turn with running the maybe-uninitialized > > warning code early would give you the warnings you expect without > > needing to run the optim

Re: -Wuninitialized issues

2005-11-02 Thread Bernhard R. Link
* Chris Lattner <[EMAIL PROTECTED]> [051102 19:28]: > > Jeff Law wrote: > >> I prefer consistency in warnings, regardless of optimization level. > >I disagree and I think we have a significant contingency of > >users that would disagree -- if optimizations allow us to avoid > >false-positive warni

Re: -Wuninitialized issues

2005-11-02 Thread Andrew Pinski
> > However, I'll freely admit this is just my notoriously fallible memory > > at work here; I've not reviewed the PRs. > Mine is as fallable as yours :-) All of the PRs that I could find, closed or not are in the meta-bug filed as PR 24639: . Thanks, Andrew Pinski

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 09:58 -0800, Mark Mitchell wrote: > Jeffrey A Law wrote: > > > Again, the problem I have with the notion that we want to get > > consistent answers is that doing so, is going to give us a lot of > > false positives. That IMHO is a huge step backwards if that's how > > we mak

Re: -Wuninitialized issues

2005-11-02 Thread Chris Lattner
On Wed, 2 Nov 2005, Jeffrey A Law wrote: On Wed, 2005-11-02 at 12:01 -0600, Chris Lattner wrote: [ ... big snip ... ] For users like myself, I would really like to have an option to switch the unused var warning to be emitted from the *front-end* where it works when compiling with optimization d

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Wed, 2005-11-02 at 12:01 -0600, Chris Lattner wrote: [ ... big snip ... ] > For users like myself, I would really like to have an option to switch the > unused var warning to be emitted from the *front-end* where it works when > compiling with optimization disabled (a huge feature in itself) a

Re: -Wuninitialized issues

2005-11-02 Thread Chris Lattner
Jeff Law wrote: > I prefer consistency in warnings, regardless of optimization level. I disagree and I think we have a significant contingency of users that would disagree -- if optimizations allow us to avoid false-positive warnings, then we should use that information to avoid those false posi

Re: -Wuninitialized issues

2005-11-02 Thread Mark Mitchell
Jeffrey A Law wrote: > Again, the problem I have with the notion that we want to get > consistent answers is that doing so, is going to give us a lot of > false positives. That IMHO is a huge step backwards if that's how > we make -Wuninitialized work. You're right that it's the users that matte

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Tue, 2005-11-01 at 12:56 -0800, Mark Mitchell wrote: > Diego Novillo wrote: > > > We won't get perfect answers, which is fine given the nature of the > > problem. However, I would like, to get *consistent* answers. > > Yes, I agree that's very important. In fact, I'd like to generalize > th

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Tue, 2005-11-01 at 13:26 -0500, Diego Novillo wrote: > We won't get perfect answers, which is fine given the nature of the > problem. However, I would like, to get *consistent* answers. If we > decide to re-organize the optimization pipeline, we should not be getting > different -Wuninitial

Re: -Wuninitialized issues

2005-11-02 Thread Jeffrey A Law
On Tue, 2005-11-01 at 22:10 -0500, Kaveh R. Ghazi wrote: > > I prefer consistency in warnings, regardless of optimization level. I disagree and I think we have a significant contingency of users that would disagree -- if optimizations allow us to avoid false-positive warnings, then we should use

Re: -Wuninitialized issues

2005-11-01 Thread Kaveh R. Ghazi
> So, to summarize, I think this is the complete set of viable > alternatives: > > 1. Status quo. Nothing changes. > > 2. Run the maybe uninitialized warning code earlier in the pipeline > with no other changes. Will result in more false positives, but > more consistent re

Re: -Wuninitialized issues

2005-11-01 Thread Mark Mitchell
Diego Novillo wrote: > We won't get perfect answers, which is fine given the nature of the > problem. However, I would like, to get *consistent* answers. Yes, I agree that's very important. In fact, I'd like to generalize that to say that -- as much as possible -- the same code should generate

Re: -Wuninitialized issues

2005-11-01 Thread Joe Buck
I wrote: > > Just an off-the-wall idea: What if dereferencing an uninitialized variable > > is considered a side effect? Then that side effect must be preserved > > unless it is unreachable. Consider > > > >while (i > 0) > > i--; > >// no more uses of i. > > > > Inst

Re: -Wuninitialized issues

2005-11-01 Thread Jeffrey A Law
On Tue, 2005-11-01 at 10:32 -0800, Joe Buck wrote: > On Tue, Nov 01, 2005 at 11:17:52AM -0700, Jeffrey A Law wrote: > > On Tue, 2005-11-01 at 11:06 -0500, Diego Novillo wrote: > > > To prevent losing location information for the warning, I had modified > > > the > > > propagation engine to warn a

Re: -Wuninitialized issues

2005-11-01 Thread Jeffrey A Law
On Tue, 2005-11-01 at 13:26 -0500, Diego Novillo wrote: > We won't get perfect answers, which is fine given the nature of the > problem. Right. > However, I would like, to get *consistent* answers. Depends on how you define "consistent" :-) > If we > decide to re-organize the optimization

Re: -Wuninitialized issues

2005-11-01 Thread Joe Buck
On Tue, Nov 01, 2005 at 11:17:52AM -0700, Jeffrey A Law wrote: > On Tue, 2005-11-01 at 11:06 -0500, Diego Novillo wrote: > > To prevent losing location information for the warning, I had modified the > > propagation engine to warn as it folded the expression away. > Possibly a useful thing to have

Re: -Wuninitialized issues

2005-11-01 Thread Diego Novillo
On Tuesday 01 November 2005 13:17, Jeffrey A Law wrote: > Possibly a useful thing to have, but I don't think we want to put > the burden of detecting uninitialized variables onto each > optimizer :-) > Heh. Indeed. > I think false positives are inevitable if we attempt to solve the > problems Ma

Re: -Wuninitialized issues

2005-11-01 Thread Diego Novillo
On Tuesday 01 November 2005 13:02, Jeffrey A Law wrote: > It's worth noting that my change will catch 18501 -- without having > to twiddle the optimizers in any way shape or form. > Excellent. That sounds so much better to what I had in mind. I'll reassign 18501 then. Thanks.

Re: -Wuninitialized issues

2005-11-01 Thread Jeffrey A Law
On Tue, 2005-11-01 at 11:06 -0500, Diego Novillo wrote: > To prevent losing location information for the warning, I had modified the > propagation engine to warn as it folded the expression away. Possibly a useful thing to have, but I don't think we want to put the burden of detecting uninitialize

Re: -Wuninitialized issues

2005-11-01 Thread Jeffrey A Law
On Tue, 2005-11-01 at 11:06 -0500, Diego Novillo wrote: > On Monday 31 October 2005 18:49, Jeffrey A Law wrote: > > > Thoughts? > > > I'm not sure this would buy you much better precision. It's less about better precision as it is about catching those cases which are hidden because of actions of

Re: -Wuninitialized issues

2005-11-01 Thread Jeffrey A Law
On Tue, 2005-11-01 at 20:49 +0900, Neil Booth wrote: > I think this is a better approach than the current one, and that > if we go down this patch then we should grasp the opportunity to > do it right - the early pass should be in the front end. Let the > optimizers do the fancy cases. 90% of ca

Re: -Wuninitialized issues

2005-11-01 Thread Diego Novillo
On Monday 31 October 2005 18:49, Jeffrey A Law wrote: > Thoughts? > I'm not sure this would buy you much better precision. I was tinkering with PR 18501 a few days ago. This is one of those cases where the optimizers (CCP in this case) remove the code that we were supposed to warn about. It

Re: -Wuninitialized issues

2005-11-01 Thread Neil Booth
Jeffrey A Law wrote:- > After pondering this some more I almost wonder if what we need is a > separate warning for variables which were potentially uninitialized > but which optimization passes somehow proved were unused or the paths > in which the variable was uninitialized were unexecutable. >

Re: -Wuninitialized issues

2005-10-31 Thread Jeffrey A Law
On Mon, 2005-10-31 at 20:46 -0800, Ian Lance Taylor wrote: > Jeffrey A Law <[EMAIL PROTECTED]> writes: > > > We clearly disagree then. Though my 15+ years of working with GCC I've > > seen far more complaints about false positives than missing instances > > of this warning. > > I think that most

Re: -Wuninitialized issues

2005-10-31 Thread Mark Mitchell
Ian Lance Taylor wrote: > Jeffrey A Law <[EMAIL PROTECTED]> writes: > > >>We clearly disagree then. Though my 15+ years of working with GCC I've >>seen far more complaints about false positives than missing instances >>of this warning. > > > I think that most of the false positives are of the

Re: -Wuninitialized issues

2005-10-31 Thread Ian Lance Taylor
Jeffrey A Law <[EMAIL PROTECTED]> writes: > We clearly disagree then. Though my 15+ years of working with GCC I've > seen far more complaints about false positives than missing instances > of this warning. I think that most of the false positives are of the form int x, f, y; f = foo ();

Re: -Wuninitialized issues

2005-10-31 Thread Mark Mitchell
Jeffrey A Law wrote: > On Mon, 2005-10-31 at 17:11 -0800, Mark Mitchell wrote: > > >>>Certainly if we can't prove f always returns a nonzero value, then a >>>warning should be issued. If we do prove f always returns a nonzero >>>value, then I think it becomes unclear if we should generate a warn

Re: -Wuninitialized issues

2005-10-31 Thread Jeffrey A Law
On Mon, 2005-10-31 at 18:52 -0500, Daniel Jacobowitz wrote: > On Mon, Oct 31, 2005 at 04:49:43PM -0700, Jeffrey A Law wrote: > > On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote: > > > In reviewing the PR list, I saw several (maybe 5?) PRs about problems > > > with -Wuninitialized. > > [ ...

Re: -Wuninitialized issues

2005-10-31 Thread Jeffrey A Law
On Mon, 2005-10-31 at 17:11 -0800, Mark Mitchell wrote: > > Certainly if we can't prove f always returns a nonzero value, then a > > warning should be issued. If we do prove f always returns a nonzero > > value, then I think it becomes unclear if we should generate a warning. > > I don't think i

Re: -Wuninitialized issues

2005-10-31 Thread Mark Mitchell
Jeffrey A Law wrote: > On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote: > >>In reviewing the PR list, I saw several (maybe 5?) PRs about problems >>with -Wuninitialized. > Where I suspect we're falling down more often is not issuing warnings > because the uninitialized variable was optimiz

Re: -Wuninitialized issues

2005-10-31 Thread Daniel Jacobowitz
On Mon, Oct 31, 2005 at 04:49:43PM -0700, Jeffrey A Law wrote: > On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote: > > In reviewing the PR list, I saw several (maybe 5?) PRs about problems > > with -Wuninitialized. > [ ... ] > After pondering this some more I almost wonder if what we need is

Re: -Wuninitialized issues

2005-10-31 Thread Jeffrey A Law
On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote: > In reviewing the PR list, I saw several (maybe 5?) PRs about problems > with -Wuninitialized. [ ... ] After pondering this some more I almost wonder if what we need is a separate warning for variables which were potentially uninitialized bu

Re: -Wuninitialized issues

2005-10-31 Thread Jeffrey A Law
On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote: > In reviewing the PR list, I saw several (maybe 5?) PRs about problems > with -Wuninitialized. Joys... > All of these problems related to getting confused in the optimizers in > various ways; sometimes we think things are uninitialized when