From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6166C385801C; Wed, 10 Aug 2022 20:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6166C385801C From: "dave.anglin at bell dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106458] [12/13 Regression] glibc's malloc/tst-scratch_buffer.c test is miscompiled with gcc-12 Date: Wed, 10 Aug 2022 20:53:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dave.anglin at bell dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.2 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-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: Wed, 10 Aug 2022 20:53:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106458 --- Comment #15 from dave.anglin at bell dot net --- On 2022-08-10 9:30 a.m., rguenth at gcc dot gnu.org wrote: > hen I try with a cc1 cross I see > >> ./cc1 -quiet t.i -fpreprocessed -O2 -g -std=3Dgnu11 -fgnu89-inline -fmer= ge-all-constants -frounding-math -fno-stack-protector -fno-common -fmath-er= rno -fno-pie -fopt-info-vec > and nothing actually vectorized. Besides the PRE there seems to be a mis= sed > DSE at the end (when vectorization is enabled as after the change): > > # DEBUG BEGIN_STMT > memset (&buf.__space.__c, 64, 1024); > # DEBUG BEGIN_STMT > + sizes[0] =3D 16; > sizes[1] =3D 1024; > sizes[2] =3D 1040; > > otherwise I see nothing suspicious in differences in .optimized when > comparing -fdump-tree-optimized with/without -fno-tree-vectorize. > I'm not sure what's going on with the sizes[0] statement but the main difference in .optimize with and without pre seems to be in the handling of the old_length variable in do_test: =C2=A0Removing basic block 86 =C2=A0int do_test () =C2=A0{ -=C2=A0 unsigned int ivtmp.23; -=C2=A0 size_t old_length; +=C2=A0 unsigned int ivtmp.28; =C2=A0=C2=A0 void * r; =C2=A0=C2=A0 void * c; =C2=A0=C2=A0 size_t l;=