From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9161 invoked by alias); 13 Feb 2014 03:17:18 -0000 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 Received: (qmail 9116 invoked by uid 48); 13 Feb 2014 03:17:13 -0000 From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/60165] New: "may be used uninitialized" warning with -O3 but not with -O2 Date: Thu, 13 Feb 2014 03:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01180.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60165 Bug ID: 60165 Summary: "may be used uninitialized" warning with -O3 but not with -O2 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net With: gcc (Debian 20140111-1) 4.9.0 20140111 (experimental) [trunk revision 206552] I get the following inconsistency in the warnings: ypig% cat out.i int a, b; int fn2 (int, int); int fn1 (int *p1) { if (fn2 (a, 0)) *p1 = b; int c; fn1 (&c); return c; } ypig% gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O2 out.i ypig% gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O3 out.i out.i: In function 'fn1': out.i:9:5: error: 'c' may be used uninitialized in this function [-Werror=maybe-uninitialized] return c; ^ cc1: some warnings being treated as errors ypig% I don't know whether this is regarded as normal, but this looks strange. Note: I got this problem when compiling round_prec.c from the GNU MPFR trunk. I generated the preprocessed file with -E, then used creduce on the following script: #!/bin/sh { gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O2 out.i && \ ! gcc-snapshot -c -Wall -Werror=maybe-uninitialized -O3 out.i } >/dev/null 2>&1 to generate the simple testcase (and fixed the declarations to avoid additional warnings -- I think I should have used -Werror in the script to avoid them in the first place).