From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3466 invoked by alias); 2 Mar 2015 19:25:51 -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 3427 invoked by uid 48); 2 Mar 2015 19:25:47 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/61409] [4.9/5 regression] -Wmaybe-uninitialized false-positive with -O2 Date: Mon, 02 Mar 2015 19:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00188.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61409 --- Comment #14 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez --- And even simpler testcase: void *init(void); struct window { int line_height; int pixel_width; int pixel_height; int column_width; int text_cols; int internal_border_width; int left_fringe_width, right_fringe_width; } *rw; void bar() __attribute__((noreturn)); void f(int i, int j) { void *ptr; if (i) { if (j) return; /* bar(); */ ptr =3D init(); } rw->pixel_width =3D ((rw->text_cols * (rw->column_width)) + (rw->left_fringe_width + (rw->right_fringe_width))= + 2 * (rw->internal_border_width)); rw->pixel_height =3D ((rw->text_cols * (rw->line_height))); if (i) { rw=3Dptr; } } And the dump: f (intD.6 iD.1843, intD.6 jD.1844) { voidD.41 * ptrD.1847; struct window * rw.0_10; intD.6 _11; intD.6 _12; intD.6 _13; intD.6 _14; intD.6 _15; intD.6 _16; intD.6 _17; intD.6 _18; intD.6 _19; intD.6 _20; intD.6 _22; intD.6 _23; ;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 0, next block 9, flags: (NEW, REACHABLE) ;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE) ;; starting at line 17 [test.c:17:8] if (i_4(D) !=3D 0) goto ; else goto ; ;; succ: 3 [50.0%] (TRUE_VALUE,EXECUTABLE) ;; 9 [50.0%] (FALSE_VALUE,EXECUTABLE) ;; basic block 9, loop depth 0, count 0, freq 5000, maybe hot ;; prev block 2, next block 3, flags: (NEW) ;; pred: 2 [50.0%] (FALSE_VALUE,EXECUTABLE) ;;=20 goto ; ;; succ: 6 [100.0%] (FALLTHRU) ;; basic block 3, loop depth 0, count 0, freq 5000, maybe hot ;; prev block 9, next block 10, flags: (NEW, REACHABLE) ;; pred: 2 [50.0%] (TRUE_VALUE,EXECUTABLE) ;; starting at line 19 [test.c:19:5] if (j_7(D) !=3D 0) goto ; else goto ; ;; succ: 10 [61.0%] (TRUE_VALUE,EXECUTABLE) ;; 5 [39.0%] (FALSE_VALUE,EXECUTABLE) ;; basic block 10, loop depth 0, count 0, freq 3051, maybe hot ;; prev block 3, next block 4, flags: (NEW) ;; pred: 3 [61.0%] (TRUE_VALUE,EXECUTABLE) ;;=20 ;; succ: 4 [100.0%] (FALLTHRU) ;; basic block 4, loop depth 0, count 0, freq 5761, maybe hot ;; prev block 10, next block 5, flags: (NEW) ;; pred: 10 [100.0%] (FALLTHRU) ;; 11 [100.0%] (FALLTHRU) ;;=20 # .MEM_47 =3D PHI <.MEM_6(D)(10), .MEM_24(11)> goto ; ;; succ: 8 [100.0%] (FALLTHRU,EXECUTABLE) ;; basic block 5, loop depth 0, count 0, freq 1949, maybe hot ;; prev block 4, next block 6, flags: (NEW, REACHABLE) ;; pred: 3 [39.0%] (FALSE_VALUE,EXECUTABLE) ;; starting at line 21 [test.c:21:6] # .MEM_8 =3D VDEF <.MEM_6(D)> # PT =3D nonlocal escaped=20 # USE =3D nonlocal=20 # CLB =3D nonlocal=20 ptr_9 =3D initD.1831 (); ;; succ: 6 [100.0%] (FALLTHRU,EXECUTABLE) ;; basic block 6, loop depth 0, count 0, freq 6949, maybe hot ;; prev block 5, next block 11, flags: (NEW, REACHABLE) ;; pred: 9 [100.0%] (FALLTHRU) ;; 5 [100.0%] (FALLTHRU,EXECUTABLE) ;; starting at line 23 # PT =3D nonlocal escaped=20 # ptr_1 =3D PHI # .MEM_2 =3D PHI <.MEM_6(D)(9), .MEM_8(5)> [test.c:23:27] # VUSE <.MEM_2> # PT =3D nonlocal escaped=20 rw.0_10 =3D rwD.1841; [test.c:23:27] # VUSE <.MEM_2> _11 =3D [test.c:23:27] rw.0_10->text_colsD.1837; [test.c:23:44] # VUSE <.MEM_2> _12 =3D [test.c:23:44] rw.0_10->column_widthD.1836; [test.c:23:39] _13 =3D _11 * _12; [test.c:24:15] # VUSE <.MEM_2> _14 =3D [test.c:24:15] rw.0_10->left_fringe_widthD.1839; [test.c:24:40] # VUSE <.MEM_2> _15 =3D [test.c:24:40] rw.0_10->right_fringe_widthD.1840; [test.c:24:35] _16 =3D _14 + _15; [test.c:24:10] _17 =3D _13 + _16; [test.c:24:72] # VUSE <.MEM_2> _18 =3D [test.c:24:72] rw.0_10->internal_border_widthD.1838; [test.c:24:67] # RANGE [-2147483648, 2147483647] NONZERO 4294967294 _19 =3D _18 * 2; [test.c:24:63] _20 =3D _17 + _19; [test.c:23:21] # .MEM_21 =3D VDEF <.MEM_2> [test.c:23:7] rw.0_10->pixel_widthD.1834 =3D _20; [test.c:25:43] # VUSE <.MEM_21> _22 =3D [test.c:25:43] rw.0_10->line_heightD.1833; [test.c:25:38] _23 =3D _11 * _22; [test.c:25:20] # .MEM_24 =3D VDEF <.MEM_21> [test.c:25:5] rw.0_10->pixel_heightD.1835 =3D _23; [test.c:26:6] if (i_4(D) !=3D 0) goto ; else goto ; ;; succ: 7 [61.0%] (TRUE_VALUE,EXECUTABLE) ;; 11 [39.0%] (FALSE_VALUE,EXECUTABLE) ;; basic block 11, loop depth 0, count 0, freq 2710, maybe hot ;; prev block 6, next block 7, flags: (NEW) ;; pred: 6 [39.0%] (FALSE_VALUE,EXECUTABLE) ;;=20 goto ; ;; succ: 4 [100.0%] (FALLTHRU) ;; basic block 7, loop depth 0, count 0, freq 4239, maybe hot ;; prev block 11, next block 8, flags: (NEW, REACHABLE) ;; pred: 6 [61.0%] (TRUE_VALUE,EXECUTABLE) ;; starting at line 28 [test.c:28:9] # .MEM_25 =3D VDEF <.MEM_24> rwD.1841 =3D ptr_1; ;; succ: 8 [100.0%] (FALLTHRU,EXECUTABLE) ;; basic block 8, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 7, next block 1, flags: (NEW, REACHABLE) ;; pred: 4 [100.0%] (FALLTHRU,EXECUTABLE) ;; 7 [100.0%] (FALLTHRU,EXECUTABLE) ;; starting at line -1, discriminator 1 # .MEM_3 =3D PHI <.MEM_47(4), .MEM_25(7)> # VUSE <.MEM_3> return; ;; succ: EXIT [100.0%]=20 } I don't really understand how the uninit pass computes the predicates, but = when replacing the "return" with "bar()", it is able to see that "j !=3D 0" is n= ot part of the predicate guarding the def of ptr. Thus, somehow the analysis t= hat works for a noreturn function fails for a normal return. >>From gcc-bugs-return-479045-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 02 19:36:49 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 59828 invoked by alias); 2 Mar 2015 19:36:49 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 59517 invoked by uid 48); 2 Mar 2015 19:36:45 -0000 From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/65256] [5 regression] Undefined symbols linking f951 Date: Mon, 02 Mar 2015 19:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: 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: 2015-03/txt/msg00189.txt.bz2 Content-length: 585 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65256 Jeffrey A. Law changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at redhat dot com --- Comment #1 from Jeffrey A. Law --- John, is this with SOM or ELF? If the former, it looks like something might be missing its .import/.export statement. What do the underlying symbols look like for the reference and the definition of those symbols?