public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/100571] New: bogus -Wstringop-overflow with VLA of elements larger than byte
@ 2021-05-12 18:42 msebor at gcc dot gnu.org
  2021-05-12 18:43 ` [Bug middle-end/100571] " msebor at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-12 18:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100571

            Bug ID: 100571
           Summary: bogus -Wstringop-overflow with VLA of elements larger
                    than byte
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

This is probably a duplicate of an existing bug already fixed in GCC 11 but not
in GCC 10.  A recent enhancement to Glibc to add attribute access to a bunch of
APIs has triggered a couple of false positives in the test suite, including:
  https://sourceware.org/pipermail/libc-alpha/2021-May/125987.html
and
  https://sourceware.org/pipermail/libc-alpha/2021-May/126250.html

A simple test case for the problem is as follows:

$ cat t.c && gcc -O2 -S -Wall t.c
__attribute__ ((access (read_only, 1, 2))) void f (int *, int);

__SIZE_TYPE__ n;

void g (void)
{
  int a[n];
  a[0] = 0;
  f (a, n);
}
t.t: In function 'g':
t.c:9:3: warning: 'f' specified size 18446744073709551615 exceeds maximum
object size 9223372036854775807 [-Wstringop-overflow=]
    9 |   f (a, n);
      |   ^~~~~~~~
t.t:1:49: note: in a call to function 'f' declared with attribute 'read_only
(1, 2)'
    1 | __attribute__ ((access (read_only, 1, 2))) void f (int *, int);
      |                                                 ^

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-12 21:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 18:42 [Bug middle-end/100571] New: bogus -Wstringop-overflow with VLA of elements larger than byte msebor at gcc dot gnu.org
2021-05-12 18:43 ` [Bug middle-end/100571] " msebor at gcc dot gnu.org
2021-05-12 18:45 ` msebor at gcc dot gnu.org
2021-05-12 21:49 ` cvs-commit at gcc dot gnu.org
2021-05-12 21:51 ` msebor at gcc dot gnu.org
2021-05-12 21:59 ` cvs-commit 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).