From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 06F9A3861026; Tue, 11 Aug 2020 17:10:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06F9A3861026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597165811; bh=7r0XtpkX1eosfsxUyVG7M1bYA3ySf6oFchC0wMdLKMU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xLgn1yl/n2bRSrlGz5n1PO7CFXixLbctrAm4lwxWYzz+A03BgMri/n4k0pO6x/m3Q jUUZA/yXPw9yBIPLAjoKXRPV3Y6bctjdlGVWADQLosm8AxY5lMPavPsDHDdi2Nl64d TiLkTxUBnEx8sByyO1arYF59AdR/0bL9WTJ2SzJU= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/96564] [11 Regression] New maybe use of uninitialized variable warning since r11-959 Date: Tue, 11 Aug 2020 17:10:10 +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: 11.0 X-Bugzilla-Keywords: alias, diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: see_also keywords 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-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2020 17:10:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96564 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D87313 Keywords| |alias, diagnostic, | |missed-optimization --- Comment #3 from Martin Sebor --- r11-959 enabled -Wuninitialized for allocated objects (alloca/VLA and mallo= c).=20 The underlying problem is the failure to take advantage of the non-aliasing guarantee of the return value of these functions. One report that describes this limitation is pr87313. A slightly simpler but even more obvious test = case is: $ cat pr96564.c && gcc -O2 -S -Wall -Wextra -fdump-tree-optimized=3D/dev/st= dout pr96564.c void f (int *x) { int a[*x]; if (a !=3D x) *a =3D 0; *x =3D *a; } pr96564.c: In function =E2=80=98f=E2=80=99: pr96564.c:8:6: warning: =E2=80=98*()[0]=E2=80=99 may be used unini= tialized [-Wmaybe-uninitialized] 8 | *x =3D *a; | ~~~^~~~ ;; Function f (f, funcdef_no=3D0, decl_uid=3D1931, cgraph_uid=3D1, symbol_o= rder=3D0) Removing basic block 5 f (int * x) { int[0:D.1936] * a.0; sizetype _2; int _8; sizetype _9; int prephitmp_18; int pretmp_20; [local count: 1073741824]: _8 =3D *x_1(D); _2 =3D (sizetype) _8; _9 =3D _2 * 4; a.0_11 =3D __builtin_alloca_with_align (_9, 32); if (x_1(D) !=3D a.0_11) goto ; [70.00%] else goto ; [30.00%] [local count: 322122544]: pretmp_20 =3D (*a.0_11)[0]; [local count: 1073741824]: # prephitmp_18 =3D PHI *x_1(D) =3D prephitmp_18; return; }=