From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10695 invoked by alias); 24 Feb 2010 20:30:24 -0000 Received: (qmail 10459 invoked by uid 48); 24 Feb 2010 20:30:04 -0000 Date: Wed, 24 Feb 2010 20:30:00 -0000 Message-ID: <20100224203004.10458.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/19808] miss a warning about uninitialized members in constructor In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-02/txt/msg02506.txt.bz2 ------- Comment #15 from manu at gcc dot gnu dot org 2010-02-24 20:30 ------- (In reply to comment #12) > Is there nothing pointed by this that could be initialized before calling the > > constructor? > > Nothing. Then for sure someone can write a generic/gimple pass that detects this case before lowering. Maybe it won't handle something more convoluted in the body of the constructor, but at least mem-initializers will be warned. One only needs to keep track which members have been initialized already, and if we use one before it has been initialized, then warn. No dataflow needed. Alternatively, the C++ front-end could create an uninitialized variable for each member variable. Initialize those, then, at the very end of the constructor, assigned each clone variable to the appropriate member. This will also enabled uninitialized warnings with the current infrastructure and it will work in the body of the constructor. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808