From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F22303849AE4; Fri, 3 May 2024 11:07:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F22303849AE4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714734466; bh=nBtSPvs7tLdgFMNG9NJ1g7qkmgWJYjVZ39hrP8t7OSQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YmQnc15eq7Pe1Z/AJT782Up0UY7IAy7niO8Wr4izkOdmRXzEUCQW4jXfc0qP6Z1eK +pL4rQNqZPVuzNYyAbeDr70zvwKElEbdaObQ5inunBtwnBixyFWM8jgdlkaHKjX6XY zSQ4EFkZY83KEvPFopA/eT3CPDUV8xxFAwtosY1c= From: "dima.pasechnik at cs dot ox.ac.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114872] [13/14/15 Regression] Miscompilation with -O2 after commit r13-8037 Date: Fri, 03 May 2024 11:07:44 +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: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dima.pasechnik at cs dot ox.ac.uk 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: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114872 Dmitrii Pasechnik changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dima.pasechnik at cs dot o= x.ac.uk --- Comment #12 from Dmitrii Pasechnik = --- A colleague disassembled, using ghidra (https://ghidra-sre.org/), the resul= ts of the compilations with, respectively, -O2 and with -O0 flags. Comparing the results, in the broken (built with -O2) case one sees a miscompilation of a call to GAP_CallFunc3Args - it is called with one argum= ent less than it should, three instead of four! broken (-O2): > plVar9 =3D (long *)GAP_CallFunc3Args(*(undefined8 *)(param_= 1 + 0x20),local_a0[4], > local_a8[4]); vs. good (-O0): < LAB_0013cbd9: < plVar10 =3D (long *)GAP_CallFunc3Args(*(undefined8 *)(param_1= + 0x20),local_a8[4], < local_a0[4],plVar16[4]); And this is despite the prototype for calling GAP_CallFunc3Args() is found in "gap/libgap-api.h", which is included in example.c as #include "gap/libgap-api.h", meant to be respected during the compilation.=20 I hope this helps in chasing down the obvious compiler bug. Perhaps it can = be also seen without disassembling, simply on the intermediate data generated = by the compiler.=