From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E0F4738485AE; Thu, 30 Jun 2022 00:50:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0F4738485AE From: "18307130172 at fudan dot edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference Date: Thu, 30 Jun 2022 00:50:45 +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: alias, needs-reduction, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: 18307130172 at fudan dot edu.cn X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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, 30 Jun 2022 00:50:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106131 --- Comment #6 from Xue Zhenliang <18307130172 at fudan dot edu.cn> --- I'm trying to reducing it further. Now I've eliminated the dependency on ST= L: struct Pair { int a, b; Pair(const Pair &) =3D default; Pair(int _a, int _b) : a(_a), b(_b) {} Pair &operator=3D(const Pair &z) { a =3D z.a; b =3D z.b; return *this; } }; const int &max(const int &a, const int &b) { return a < b ? b : a; } int foo(Pair x, Pair y) { return max(x.b, y.b); } int main() { auto f =3D new Pair[3] {{0, -11}, {0, -8}, {0, 2}}; for (int i =3D 0; i < 1; i++) { f[i] =3D f[0]; if(i =3D=3D 0) f[i] =3D f[2]; if (foo(f[i], f[1]) !=3D 2) __builtin_abort(); } }=