From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ED9C33895FC3; Tue, 15 Nov 2022 13:14:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED9C33895FC3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668518082; bh=ZDX7prCxLCSKJm6TUr6VXNCrYWQ7nYe31DU9z7Zf5qM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ap03/5AJPJeYlSlI5msL5bN3IL1oRLYovQUoyTQtx2aVMBQ6xrxdLBWBNfccWvSjJ dBzHc7rcWAnpL6Ne+1aVPOi3nuOoKmbQQEKiVd3urP4unhgpQfitohlqRz4CWqH+8u g3QVUeDOBFt/nbG79QGwwbkMXPb9yM1C9gdfk6qs= From: "carlosgalvezp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107677] -Warray-bounds: unclear what exactly it's meant to detect Date: Tue, 15 Nov 2022 13:14:42 +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: 13.0 X-Bugzilla-Keywords: diagnostic, documentation X-Bugzilla-Severity: normal X-Bugzilla-Who: carlosgalvezp at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: 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=3D107677 --- Comment #5 from Carlos Galvez --- Wow, that was mind blowing, thanks for the clarification! Such thing I'd li= ke to have in the docs, it's very easy to confuse with the other message: note: at offset 48 into object '' of size 48 So one offset is an actual index, and the other is a "mathematical range of indices". Back to my example: error: array subscript [-536870912, -1] is outside array bounds I don't see these numbers in my code. Therefore I wonder: how does GCC comp= ute these numbers? Are they based on my code, or are they based on: "if the user pass you the number -536870912 as input at runtime, then you'll do out-of-bounds"?=