[Bug c++/11182] New: gcc should warn when assigning unassigned variables

charles@kde.org gcc-bugzilla@gcc.gnu.org
Fri Jun 13 04:58:00 GMT 2003


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.



More information about the Gcc-bugs mailing list