This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/924: -Wuninitialized does not seem to warn on uninitialize class members.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/924: -Wuninitialized does not seem to warn on uninitialize class members.
- From: mdejong at redhat dot com
- Date: 29 Nov 2000 10:23:32 -0000
- Reply-To: mdejong at redhat dot com
>Number: 924
>Category: c++
>Synopsis: -Wuninitialized does not seem to warn on uninitialize class members.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 29 02:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: mdejong@redhat.com
>Release: CVS gcc as of Wed Nov 29 2000, all earlier releases
>Organization:
>Environment:
Linux (Red Hat 6.2)
>Description:
I would think that the following uninitialize
memory would get noticed by g++. I get
no warnings, even when I pass the -Wall
and -Wuninitialized flags.
class no_init {
private:
int num;
char *ptr;
public:
no_init(): num(0) {
}
~no_init() {
delete [] ptr; // This memory is never initialized!
}
};
int main() {
no_init();
}
% g++ -static -o noinit -g -Wall -O2 -Wuninitialized no_init.cpp
% ./noinit
Segmentation fault (core dumped)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: