From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24655 invoked by alias); 16 Oct 2008 19:09:31 -0000 Received: (qmail 17233 invoked by uid 48); 16 Oct 2008 19:08:08 -0000 Date: Thu, 16 Oct 2008 19:09:00 -0000 Message-ID: <20081016190808.17232.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/37854] No error when creating a variable from itself In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia 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: 2008-10/txt/msg01120.txt.bz2 ------- Comment #4 from pinskia at gcc dot gnu dot org 2008-10-16 19:08 ------- In this case since x and y are empty structs there are no real uses of them. If I change the code to: struct X {int i;}; int main() { int i = i; X x = x; X y(y); return i+x.i+y.i; } --- CUT --- And turn on optimization, I get the following warnings: t.c: In function 'int main()': t.c:5: warning: 'i' is used uninitialized in this function t.c:8: warning: 'x.X::i' is used uninitialized in this function t.c:8: warning: 'y.X::i' is used uninitialized in this function Note all of the above warnings should only happen with -Winit-self (which works correctly with the C front-end and is PR 34772 ). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37854