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

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).