From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 43F593858D35; Mon, 26 Jun 2023 09:33:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43F593858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687772015; bh=0k0seg0LrEyrzxtnYosOyUJvHz6qTiUTpA8OMt9MZ3E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sl3KIsN3G6o4Et1HzDl+SFd6vHPjwYp/ssBjuOkivZl/JYDoQeRtjkwoB2UHIByzh OXZs3olaHE0I0LAA1d0rxuYyAMlX3JIq2Fl0Lke2OgrqMsoRJjbIMWjJxEuKZHhl0W vF5Yh89WKUxvmoQ/qfIWflSUvCU01+OQqiFhEXb0= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110381] [11/12/13/14 Regression] double counting for sum of structs of floating point types Date: Mon, 26 Jun 2023 09:33:34 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110381 --- Comment #7 from Richard Biener --- C testcase: struct FOO { double a; double b; double c; }; double __attribute__((noipa)) sum_8_foos(const struct FOO* foos) { double sum =3D 0; for (int i =3D 0; i < 8; ++i) { struct FOO foo =3D foos[i]; sum +=3D foo.c; sum +=3D foo.b; sum +=3D foo.a; } return sum; } int main() { struct FOO foos[8]; __builtin_memset (foos, 0, sizeof (foos)); foos[0].b =3D 5; if (sum_8_foos (foos) !=3D 5) __builtin_abort (); return 0; }=