public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11182] New: gcc should warn when assigning unassigned variables
@ 2003-06-13  4:58 charles@kde.org
  2003-06-14 13:35 ` [Bug c++/11182] " pinskia@physics.uc.edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: charles@kde.org @ 2003-06-13  4:58 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=11182

           Summary: gcc should warn when assigning unassigned variables
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: charles@kde.org
                CC: gcc-bugs@gcc.gnu.org

in a block of code like this: 
 
	int x; 
	int y = x; 
 
I think gcc should warn that you're assigning x to y without x being modified. 
 
The real story is I wrote stupid code like this: 
 
void foo(Node *node) 
{ 
	for (Node *node = node->child; node; node = node->next) 
	{ ... } 
} 
	(the meaning of this code is inconsequential, so I'm not providing a real sample) 
 
This error however could be fixed by reporting assignment from unmodified variables.


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
@ 2003-06-14 13:35 ` pinskia@physics.uc.edu
  2003-06-14 17:18 ` falk.hueffner@student.uni-tuebingen.de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-14 13: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=11182


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


------- Additional Comments From pinskia@physics.uc.edu  2003-06-14 13:35 -------
With this source:   int f(){ int x; int y = x; return y; }
I get a warning at -O1 -W -Wall with 2.95.2, 3.1, and the mainline ().
Do you want the warning at -O0 if you do this is a know problem?


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
  2003-06-14 13:35 ` [Bug c++/11182] " pinskia@physics.uc.edu
@ 2003-06-14 17:18 ` falk.hueffner@student.uni-tuebingen.de
  2003-06-14 17:24 ` charles@kde.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: falk.hueffner@student.uni-tuebingen.de @ 2003-06-14 17:18 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=11182



------- Additional Comments From falk.hueffner@student.uni-tuebingen.de  2003-06-14 17:14 -------
Subject: Re:  gcc should warn when assigning unassigned variables

"pinskia@physics.uc.edu" <gcc-bugzilla@gcc.gnu.org> writes:

> With this source: int f(){ int x; int y = x; return y; } I get a
> warning at -O1 -W -Wall with 2.95.2, 3.1, and the mainline ().  Do
> you want the warning at -O0 if you do this is a know problem?

I suppose it's rather another instance of

int f() { int x = x; return x; }

i. e., no warning when initializing a variable with itself, which is
already c++/5284 and probably some more.


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
  2003-06-14 13:35 ` [Bug c++/11182] " pinskia@physics.uc.edu
  2003-06-14 17:18 ` falk.hueffner@student.uni-tuebingen.de
@ 2003-06-14 17:24 ` charles@kde.org
  2003-06-14 18:27 ` falk.hueffner@student.uni-tuebingen.de
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: charles@kde.org @ 2003-06-14 17:24 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=11182



------- Additional Comments From charles@kde.org  2003-06-14 17:24 -------
Subject: Re:  gcc should warn when assigning unassigned variables

On Saturday 14 June 2003 10:14, you wrote:
> ------- Additional Comments From falk.hueffner@student.uni-tuebingen.de 
> 2003-06-14 17:14 ------- Subject: Re:  gcc should warn when assigning
> unassigned variables
>
> "pinskia@physics.uc.edu" <gcc-bugzilla@gcc.gnu.org> writes:
> > With this source: int f(){ int x; int y = x; return y; } I get a
> > warning at -O1 -W -Wall with 2.95.2, 3.1, and the mainline ().  Do
> > you want the warning at -O0 if you do this is a know problem?
>
> I suppose it's rather another instance of
>
> int f() { int x = x; return x; }
>
> i. e., no warning when initializing a variable with itself, which is
> already c++/5284 and probably some more.

Well, more than "initializing a variable with itself", but "assigning a 
variable with an uninitialized variable"

{
	int x;
	int y = x;
}

should warn it as well


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (2 preceding siblings ...)
  2003-06-14 17:24 ` charles@kde.org
@ 2003-06-14 18:27 ` falk.hueffner@student.uni-tuebingen.de
  2003-06-14 19:14 ` charles@kde.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: falk.hueffner@student.uni-tuebingen.de @ 2003-06-14 18:27 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=11182



------- Additional Comments From falk.hueffner@student.uni-tuebingen.de  2003-06-14 18:27 -------
Subject: Re:  gcc should warn when assigning unassigned variables

"charles@kde.org" <gcc-bugzilla@gcc.gnu.org> writes:

> > ------- Additional Comments From falk.hueffner@student.uni-tuebingen.de 
> > int f() { int x = x; return x; }
> >
> > i. e., no warning when initializing a variable with itself, which is
> > already c++/5284 and probably some more.
> 
> Well, more than "initializing a variable with itself", but "assigning a 
> variable with an uninitialized variable"
> 
> {
> 	int x;
> 	int y = x;
> }
> 
> should warn it as well

Sure it should, but that works already.


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (3 preceding siblings ...)
  2003-06-14 18:27 ` falk.hueffner@student.uni-tuebingen.de
@ 2003-06-14 19:14 ` charles@kde.org
  2003-06-14 19:28 ` [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating pinskia@physics.uc.edu
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: charles@kde.org @ 2003-06-14 19:14 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=11182



------- Additional Comments From charles@kde.org  2003-06-14 19:14 -------
Subject: Re:  gcc should warn when assigning unassigned variables

On Saturday 14 June 2003 11:27, you wrote:
> > Well, more than "initializing a variable with itself", but "assigning a
> > variable with an uninitialized variable"
> >
> > {
> >       int x;
> >       int y = x;
> > }
> >
> > should warn it as well
>
> Sure it should, but that works already.

Ho hum, you're right, but it depends on -O1, which I think is ironic because 
if you're using -O1, you're probably not doing development, which means you 
probably don't care about it anyway.

Probably a big change though (I don't actually know gcc's code).

-Charles


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (4 preceding siblings ...)
  2003-06-14 19:14 ` charles@kde.org
@ 2003-06-14 19:28 ` pinskia@physics.uc.edu
  2003-06-14 20:35 ` bangerth@dealii.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-14 19:28 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=11182


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-06-14 19:28:09
               date|                            |
            Summary|gcc should warn when        |gcc should warn when
                   |assigning unassigned        |assigning unassigned
                   |variables                   |variables when not
                   |                            |optimizating


------- Additional Comments From pinskia@physics.uc.edu  2003-06-14 19:28 -------
This has been discussed before <http://gcc.gnu.org/ml/gcc/2001-07/msg01175.html>


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (5 preceding siblings ...)
  2003-06-14 19:28 ` [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating pinskia@physics.uc.edu
@ 2003-06-14 20:35 ` bangerth@dealii.org
  2003-06-14 20:39 ` pinskia@physics.uc.edu
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth@dealii.org @ 2003-06-14 20: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=11182



------- Additional Comments From bangerth@dealii.org  2003-06-14 20:35 -------
As has been pointed out, the non-availability of -Wuninitialized without
turning on optimization is not a bug. So let's close the report.
W.


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (6 preceding siblings ...)
  2003-06-14 20:35 ` bangerth@dealii.org
@ 2003-06-14 20:39 ` pinskia@physics.uc.edu
  2004-02-01 14:33 ` pinskia at gcc dot gnu dot org
  2004-02-01 19:49 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-14 20:39 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=11182


pinskia@physics.uc.edu changed:

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


------- Additional Comments From pinskia@physics.uc.edu  2003-06-14 20:39 -------
Closing as the emails that I pointed you to said this was never going to be fixed as it introduces 
too many false positives.


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (7 preceding siblings ...)
  2003-06-14 20:39 ` pinskia@physics.uc.edu
@ 2004-02-01 14:33 ` pinskia at gcc dot gnu dot org
  2004-02-01 19:49 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-01 14:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-01 14:33 -------
*** Bug 13959 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d dot binderman at virgin
                   |                            |dot net


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


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

* [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating
  2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
                   ` (8 preceding siblings ...)
  2004-02-01 14:33 ` pinskia at gcc dot gnu dot org
@ 2004-02-01 19:49 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-01 19:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-01 19:49 -------
*** Bug 13959 has been marked as a duplicate of this bug. ***

-- 


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


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

end of thread, other threads:[~2004-02-01 19:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-13  4:58 [Bug c++/11182] New: gcc should warn when assigning unassigned variables charles@kde.org
2003-06-14 13:35 ` [Bug c++/11182] " pinskia@physics.uc.edu
2003-06-14 17:18 ` falk.hueffner@student.uni-tuebingen.de
2003-06-14 17:24 ` charles@kde.org
2003-06-14 18:27 ` falk.hueffner@student.uni-tuebingen.de
2003-06-14 19:14 ` charles@kde.org
2003-06-14 19:28 ` [Bug c++/11182] gcc should warn when assigning unassigned variables when not optimizating pinskia@physics.uc.edu
2003-06-14 20:35 ` bangerth@dealii.org
2003-06-14 20:39 ` pinskia@physics.uc.edu
2004-02-01 14:33 ` pinskia at gcc dot gnu dot org
2004-02-01 19:49 ` 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).