From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B8C23858037; Thu, 11 Nov 2021 18:56:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B8C23858037 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103194] [12 Regression] ice in optimize_atomic_bit_test_and with __sync_fetch_and_and Date: Thu, 11 Nov 2021 18:56:15 +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.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: blocker X-Bugzilla-Who: hjl.tools at gmail dot com 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: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed 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, 11 Nov 2021 18:56:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103194 H.J. Lu changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-11-11 Ever confirmed|0 |1 --- Comment #2 from H.J. Lu --- The narrowing cast isn't handled: [hjl@gnu-cfl-2 pr102566]$ cat x3.c #include int foo (_Atomic long long int *v) { return atomic_fetch_or_explicit (v, 1, memory_order_relaxed) & 1; } [hjl@gnu-cfl-2 pr102566]$ make x3.s /export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O= 2 -S x3.c [hjl@gnu-cfl-2 pr102566]$ cat x3.s .file "x3.c" .text .p2align 4 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc movq (%rdi), %rax .L2: movq %rax, %rcx movq %rax, %rdx orq $1, %rcx lock cmpxchgq %rcx, (%rdi) jne .L2 movl %edx, %eax andl $1, %eax ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 12.0.0 20211111 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 pr102566]$=