From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 78E6B3858D39; Thu, 3 Mar 2022 05:08:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78E6B3858D39 From: "570070308 at qq dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104763] [12.0] Generate wrong assembly code Date: Thu, 03 Mar 2022 05:08:24 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: 570070308 at qq dot com 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: --- 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: Thu, 03 Mar 2022 05:08:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104763 --- Comment #3 from =E3=80=82 <570070308 at qq dot com> --- (In reply to Jakub Jelinek from comment #2) > Can't reproduce with -O2, with -O1 there are 2 stores instead of 3 > before the endless loop starting with > r9-384-gf1bcb061d172ca7e3bdcc46476b20776382a2974 edit `+2` to `+7` then -O3 will be wrong too. test.c: ``` #include #include #include void move_up() { for ( size_t* i=3D(size_t *)(0xb8000+160*24); ; ) { *i=3D0x0700070007000700; if ( i =3D=3D (size_t *)(0xb8000+160*24)+7 ) { break; } ++i; } while (1){} } ``` assembly with -O3: ``` move_up: .LFB0: .cfi_startproc endbr64 movabsq $504410854964332288, %rax movq %rax, 757512 movq %rax, 757520 movq %rax, 757528 movq %rax, 757536 movq %rax, 757544 movq %rax, 757552 movq %rax, 757560 .L2: jmp .L2 .cfi_endproc ```=