From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26421 invoked by alias); 18 Aug 2008 22:59:46 -0000 Received: (qmail 25748 invoked by uid 48); 18 Aug 2008 22:58:26 -0000 Date: Mon, 18 Aug 2008 22:59:00 -0000 Message-ID: <20080818225826.25747.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/36296] wrong warning about potential uninitialized variable In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "vincent at vinc17 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-08/txt/msg01341.txt.bz2 ------- Comment #9 from vincent at vinc17 dot org 2008-08-18 22:58 ------- (In reply to comment #8) > Please provide a preprocessed reduced testcase as similar to the original as > possible. Here's a similar testcase. $ cat tst.c void *foo (void); void bar (void *); void f (void) { int init = 0; void *p; while (1) { if (init == 0) { p = foo (); init = 2; } bar (p); } } $ gcc -Wall -O2 tst.c -c tst.c: In function 'f': tst.c:7: warning: 'p' may be used uninitialized in this function This is quite strange: if I replace the value 2 by 1 or if I replace foo() by 0, the warning is no longer displayed. Note: in the reality (in MPFR), the variable I called init here is the size of the array (0 when the array hasn't been allocated yet). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296