public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106738] New: -Wlarger-than triggering for *.LASAN0 section
@ 2022-08-25 7:35 frolov.da at phystech dot edu
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
0 siblings, 2 replies; 3+ messages in thread
From: frolov.da at phystech dot edu @ 2022-08-25 7:35 UTC (permalink / raw)
To: gcc-bugs
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=]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/106738] -Wlarger-than triggering for *.LASAN0 section
2022-08-25 7:35 [Bug c++/106738] New: -Wlarger-than triggering for *.LASAN0 section frolov.da at phystech dot edu
@ 2022-08-25 8:30 ` rguenth at gcc dot gnu.org
2022-08-25 17:25 ` [Bug middle-end/106738] " pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-25 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106738
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |diagnostic
Last reconfirmed| |2022-08-25
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/106738] -Wlarger-than triggering for *.LASAN0 section
2022-08-25 7:35 [Bug c++/106738] New: -Wlarger-than triggering for *.LASAN0 section frolov.da at phystech dot edu
2022-08-25 8:30 ` [Bug c++/106738] " rguenth at gcc dot gnu.org
@ 2022-08-25 17:25 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-25 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106738
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe DECL_IGNORED_P or DECL_ARTIFICIAL should be checked before calling
warning in stor-layout.cc?
Because:
in asan.cc:
ASM_GENERATE_INTERNAL_LABEL (buf, "LASAN", 0);
var = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier (buf),
type);
TREE_STATIC (var) = 1;
TREE_PUBLIC (var) = 0;
DECL_ARTIFICIAL (var) = 1;
DECL_IGNORED_P (var) = 1;
...
in stor-layout.cc before doing the warning call:
/* If requested, warn about definitions of large data objects. */
if ((code == PARM_DECL || (code == VAR_DECL && !DECL_NONLOCAL_FRAME (decl)))
&& !DECL_EXTERNAL (decl))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-25 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 7:35 [Bug c++/106738] New: -Wlarger-than triggering for *.LASAN0 section frolov.da at phystech dot edu
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
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).