From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 185FC3858D37; Sun, 4 Sep 2022 06:06:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 185FC3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662271619; bh=edAWm7QpQ537PhxTyfabH1xbMtXgTdiqJ17PiVmflow=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AW6Bgiq1jU8mSieAoC3sUkHys8mOcJ6iSAC5yPP/l8W8ME0cR8nGDr6UHeGgBM1ti QQhe/X2l475fH0iGx812s9UkSdXGdGCWuQZXoOp5tutDmtuBpWcEu+9Q9nzWQfAbZ0 LlxhruUdXLXnrL08JVu93ikjphzWlJthpLP+fswc= From: "mwd at md5i dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106247] GCC12 warning in Eigen: array subscript is partly outside array bounds Date: Sun, 04 Sep 2022 06:06:58 +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: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mwd at md5i dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D106247 Michael Duggan changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mwd at md5i dot com --- Comment #7 from Michael Duggan --- I am working with some code that exhibits a similar problem. I've run cred= uce on the preprocessed code to create an exemplar, which I have attached as bug-mwd.cpp. Here's the relevant warnings from g++ 12.2.0 using '-std=3Dc+= +14 -Wall -O2': In member function =E2=80=98void i< >::m(k*) [with= ab =3D s]=E2=80=99, inlined from =E2=80=98void i< >::m(k*) [with a= b =3D I]=E2=80=99 at bug.cpp:25:26, inlined from =E2=80=98i< >::i(n) [with n =3D I= *; ab =3D I]=E2=80=99 at bug.cpp:23:39, inlined from =E2=80=98am I::u()=E2=80=99 at bug.cpp:48:3: bug.cpp:27:5: warning: array subscript =E2=80=98i::k {aka s}[0]=E2=80=99= is partly outside array bounds of =E2=80=98unsigned char [40]=E2=80=99 [-Warray-bounds] 27 | e(p->aa); | ^~~~~~~~ bug.cpp: In member function =E2=80=98am I::u()=E2=80=99: bug.cpp:48:9: note: object of size 40 allocated by =E2=80=98operator new=E2= =80=99 48 | o(new I); | ^ The example is convoluted, I am afraid. One very strange bit is that if I change the 'o's in 'class I' to, say, 'p', I get a completely different err= or. If you think this is unrelated, let me know, and I will submit a new bug report.=