From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 394933857823; Tue, 22 Mar 2022 08:20:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 394933857823 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104964] Wrong *** buffer overflow detected ***: terminated - acl Date: Tue, 22 Mar 2022 08:20:15 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: siddhesh at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Tue, 22 Mar 2022 08:20:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104964 --- Comment #6 from Martin Li=C5=A1ka --- I've got something similar that can be seen in libqt5core library: QByteArray qt_readlink(const char *path) { #ifndef PATH_MAX // suitably large value that won't consume too much memory # define PATH_MAX 1024*1024 #endif QByteArray buf(256, Qt::Uninitialized); ssize_t len =3D ::readlink(path, buf.data(), buf.size()); ... where they use something like: struct QArrayData { ... void *data() { return reinterpret_cast(this) + offset; } Can't easily reproduce a small test can thought.=