From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 268AF3858D28; Fri, 12 Aug 2022 04:23:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 268AF3858D28 From: "andres at anarazel dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106590] New: x86-64 miscompilation starting with "i386: Improve ix86_expand_int_movcc" w/ mtune=skylake Date: Fri, 12 Aug 2022 04:23:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andres at anarazel dot de 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 12 Aug 2022 04:23:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106590 Bug ID: 106590 Summary: x86-64 miscompilation starting with "i386: Improve ix86_expand_int_movcc" w/ mtune=3Dskylake Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: andres at anarazel dot de Target Milestone: --- Hi, The attached reproducer shows a miscompilation I found building postgres. I= 've bisected postgres' failure to 1ceddd7497e, but it's of course possible it's just surfacing a prior issue. In my reproducer, and in postgres, the problem only occurs with -mtune=3Dsk= ylake or higher, but I'm not sure how related that actually is. $ /home/andres/build/gcc-master/install/bin/gcc --version gcc (GCC) 12.0.1 20220423 (experimental) Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc-11 --version gcc-11 (Debian 11.3.0-5) 11.3.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ /home/andres/build/gcc-master/install/bin/gcc -Wall -Wextra -O1 -mtune=3Dskylake /tmp/test.i -o /tmp/test $ /tmp/test wrong results: procform->prorettype: 23, restype: 20 $ /home/andres/build/gcc-master/install/bin/gcc -Wall -Wextra -O1 -mtune=3Dbroadwell /tmp/test.i -o /tmp/test $ /tmp/test everything ok: procform->prorettype: 23, restype: 23 $ gcc-11 -Wall -Wextra -O1 -mtune=3Dskylake /tmp/test.i -o /tmp/test $ /tmp/test everything ok: procform->prorettype: 23, restype: 23 I think it's pretty obvious that the code should never be able to result in restype =3D=3D 20. Regards, Andres=