From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DCDE3858C62; Wed, 8 Feb 2023 15:52:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DCDE3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675871567; bh=aSLRtk+eHr4UNA5WV0+51bOSh3wgBVzGgZDQ+oSCTKk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NAvRyQ4dKE9bWbqN4tfPwkHF5lIDpy6rKB72xR31uu0ktfuT7y9aQccoeP/WuIrfb G8pjCcMqv3FBEtoe5+v1qhgihQoUJR+MvH9dcfAwcgbAxtc/vdhjhvwcmfs3xGHNTN eun3pHIZf59HdRi6U5R0TAf1lHawyRDOGpNVvsmQ= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/108695] [13 Regression] Wrong code since r13-5215-gb1f30bf42d8d47 for dd_rescue package Date: Wed, 08 Feb 2023 15:52:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: lto, needs-reduction, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108695 --- Comment #15 from Martin Li=C5=A1ka --- (In reply to Jakub Jelinek from comment #14) > (In reply to Martin Li=C5=A1ka from comment #10) > > > where the XOR16 is implemented as: > > >=20 > > > #define XORN(in1,in2,out,len) \ > > > do { \ > > > uint _i; \ > > > for (_i =3D 0; _i < len/sizeof(ulong); ++_i) \ > > > *((ulong*)(out)+_i) =3D *((ulong*)(in1)+_i) ^ *((ulong*)(in2)+_i); \ > > > } while(0) > >=20 > > I can confirm that changing that to: > >=20 > > #define XORN(in1, in2, out, len) \ > > do \ > > { \ > > uint _i; \ > > for (_i =3D 0; _i < len; ++_i) \ > > *(out + _i) =3D *(in1 + _i) ^ *(in2 + _i); \ > > } while (0) > >=20 > > fixes the problem. It seems very close to what I saw here: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83201#c13 >=20 > It depends on if those arrays were stored as ulong or will be later read = as > ulong or something else. Yes, that's what happens, they are stored with the aforementioned XORN func= tion as ulong types. And later are read with=20 #define GETU32(p) ntohl(*((u32*)(p))) as u32. That's the aliasing violation.=