public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "frolov.da at phystech dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/106738] New: -Wlarger-than triggering for *.LASAN0 section
Date: Thu, 25 Aug 2022 07:35:12 +0000 [thread overview]
Message-ID: <bug-106738-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106738
Bug ID: 106738
Summary: -Wlarger-than triggering for *.LASAN0 section
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: frolov.da at phystech dot edu
Target Milestone: ---
The behaviour of the warning flag -Wlarger-than is described in documentationL
> warn whenever an object is defined whose size exceeds byte-size.
> -Wlarger-than=‘PTRDIFF_MAX’ is enabled by default. Warnings controlled by the
> option can be disabled either by specifying byte-size of ‘SIZE_MAX’ or more or
> by -Wno-larger-than.
> Also warn for calls to bounded functions such as memchr or strnlen that
> specify a bound greater than the largest possible object, which is
> ‘PTRDIFF_MAX’ bytes by default.
I've tried to build the next example:
#include <assert.h>
void foo () {
assert (false);
}
$ g++ -O2 -c -Wlarger-than=16 -fsanitize=address minimal.cpp
And got a warning:
cc1plus: warning: size of ‘*.LASAN0’ 192 bytes exceeds maximum object size 16
[-Wlarger-than=]
It looks like a false triggering. From my point of view the user should not
monitor the size of the analyzer section.
Moreover, if we would try to add another assert:
#include <assert.h>
void foo () {
assert (false);
}
void goo () {
assert (false);
}
Then we'll get:
cc1plus: warning: size of ‘*.LASAN0’ 256 bytes exceeds maximum object size 16
[-Wlarger-than=]
next reply other threads:[~2022-08-25 7:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 7:35 frolov.da at phystech dot edu [this message]
2022-08-25 8:30 ` [Bug c++/106738] " rguenth at gcc dot gnu.org
2022-08-25 17:25 ` [Bug middle-end/106738] " pinskia at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-106738-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).