From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E6590385041F; Mon, 27 Jul 2020 07:43:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6590385041F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595835782; bh=GP1Kx45KU8ZtpZ8BFYP/falgCbudL+8vt3NnXvKThcA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZvufrUmqm8PH/fSzc6GLkJ+7FKXRbtwkS9ypGB845jZSSq76QcPA4Ajp5Ej9xAe+v pIPzbhkbKfSKRWLz+G0tUo9aA7quPnTzLq8N6/wl1hLJHNq0pJ3ULmDRsTQZ9jfQuz EsvF2Nmew06ucazPOBQ8oLfmaZb3N2toIdUVd+No= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/96326] [10/11 Regression] Incorrect loop optimization at -O3 since r10-4803-g8489e1f45b50600c Date: Mon, 27 Jul 2020 07:43:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status target_milestone 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: Mon, 27 Jul 2020 07:43:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96326 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |RESOLVED Target Milestone|--- |10.3 --- Comment #4 from Richard Biener --- The following works - your unsigned long objects are not aligned according to the type which makes the accesses undefined (actually C even specifies forming the pointer itself is undefined). #include #include typedef unsigned long mylong __attribute__((aligned(1))); int main() { char buf[128]; char *src =3D buf; char *op =3D buf + 3; int len =3D 64; strcpy(buf, "abc"); while (op - src < 8) { *(mylong*)op =3D *(const mylong*)src; len -=3D op - src; op +=3D op - src; } while (len > 0) { *(mylong*)op =3D *(const mylong*)src; src +=3D 8; op +=3D 8; len -=3D 8; } printf("%ld\n", strlen(buf)); }=