From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A6E94386D61E; Thu, 15 Feb 2024 20:16:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6E94386D61E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1708028207; bh=MzzjUSEuxx6sXjGYBtLFXT+9Cj+ZjuktzkxqX0ZWWFE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xeGvTzbw3IfX0rUnDJkDN/K1jM2DDkGI/CAhldfb32CTl02dy+NvyNCU1S+CBo8dk kYZUHYZJL3EPCr3VPW9WdcpeTgqZA1VzsUqRyaYufLZ9PaIdJQtCi5YfAxpgnt02d9 n7/Ef44Zy8MeAUEH8gkq5JKj2YwpkItZfGJKEl0Q= From: "siddhesh at sourceware dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/31383] _FORTIFY_SOURCE=3 and __fortified_attr_access vs size of 0 and zero size types Date: Thu, 15 Feb 2024 20:16:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at sourceware dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: siddhesh at sourceware dot 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31383 --- Comment #3 from Siddhesh Poyarekar --- (In reply to Siddhesh Poyarekar from comment #1) > ``` > When no size-index argument is specified, the pointer argument must be > either null or point to a space that is suitably aligned and large for __= at > least one object__ of the referenced type (this implies that a past-the-e= nd > pointer is not a valid argument). > ``` >=20 > Well technically, the pointer argument *is* suitably aligned and large for > 16 objects of 0 size, but the implication that it is hence not a > past-the-end pointer is invalid. I'll drop the access attribute (since t= he > additional value from having it is not really significant enough) but IMO > -Wstringop-overflow needs to be fixed to handle pointers to zero-sized > structs, i.e. it needs to ignore them and not conjure up an access size o= f 1 > out of nowhere. Actually, no, I was wrong. The referenced type is void*, which is why the warning is 'correct'. Maybe there's scope for better wording, but it does = make sense to warn in such cases: extern void f2 (void *) __attribute__ ((__access__ (__write_only__, 1))); void f1 (void) { struct A {} a[16]; f2 (a); } --=20 You are receiving this mail because: You are on the CC list for the bug.=