From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BA813858426; Sat, 20 Jan 2024 01:42:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BA813858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705714939; bh=xSO5sBrtl5sHXN8k6plr2DJc7z6RLsWKn+pjJm+XhDI=; h=From:To:Subject:Date:From; b=fcCo3TJWEEfF7jHQp5pDogN6eQrMGiRv/1roUm7eB+odjb/YkUNXVhtvkBgziS+Rs w9YBNl/66mr8JQWz4P/SXFEMQPjgqrT16dASUKsUznUclbSlPyiRbRMkDT6OtALVpR 4o+14CiFdJgXf9UCLgd0yeF++ICuxWdJxdZn1oNM= From: "sandra at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113515] New: Wrong documentation for -Wstringop-overflow Date: Sat, 20 Jan 2024 01:42:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sandra at gcc dot gnu.org 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D113515 Bug ID: 113515 Summary: Wrong documentation for -Wstringop-overflow Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sandra at gcc dot gnu.org Target Milestone: --- This is essentially the example for -Warray-parameter=3D1 in the manual (see PR102998): #include void f (int[static 4]); void f (int[]); // warning 1 void g (void) { int *p =3D (int *) malloc (1 * sizeof(int)); f (p); // warning 2 } Warning 2 is: example.c: In function 'g': example.c:9:3: warning: 'f' accessing 16 bytes in a region of size 4 [-Wstringop-overflow=3D] 9 | f (p); | ^~~~~ example.c:9:3: note: referencing argument 1 of type 'int[4]' example.c:4:6: note: in a call to function 'f' 4 | void f (int[]); | ^ It's correct to warn here, but the manual is not helpful in explaining what -Wstringop-overflow has to do with it. The documentation for -Wstringop-overflow says: Warn for calls to string manipulation functions such as @code{memcpy} and @code{strcpy} that are determined to overflow the destination buffer. There are no string manipulation functions in this example. I presume additional kinds of object-size checking, beyond calls to string/byte array manipulation functions from the standard library, were overloaded onto this option without updating its description. Can we get a better summary of wh= at it does now?=