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

* [Bug middle-end/100571] bogus -Wstringop-overflow with VLA of elements larger than byte
  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 ` msebor at gcc dot gnu.org
  2021-05-12 18:45 ` msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-12 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |88443
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-12
      Known to fail|                            |10.1.0, 10.2.0, 10.3.0
      Known to work|                            |11.1.0, 9.3.0
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
   Target Milestone|---                         |10.4
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |diagnostic


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
[Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings

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

* [Bug middle-end/100571] bogus -Wstringop-overflow with VLA of elements larger than byte
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-12 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=27832

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
See also https://sourceware.org/bugzilla/show_bug.cgi?id=27832

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

* [Bug middle-end/100571] bogus -Wstringop-overflow with VLA of elements larger than byte
  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
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Sebor
<msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:0d1e4025b2bd2ce36d6ee2a5d836d31ec8a12999

commit r10-9819-g0d1e4025b2bd2ce36d6ee2a5d836d31ec8a12999
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed May 12 15:45:44 2021 -0600

    PR middle-end/100571 - bogus -Wstringop-overflow with VLA of elements
larger than byte

    gcc/ChangeLog:
            PR middle-end/100571
            * calls.c (maybe_warn_rdwr_sizes): Clear object size if it can't
            be determined.

    gcc/testsuite/ChangeLog:
            PR middle-end/100571
            * gcc.dg/Wstringop-overflow-67.c: New test.

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

* [Bug middle-end/100571] bogus -Wstringop-overflow with VLA of elements larger than byte
  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
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-12 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in r10-9819.

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

* [Bug middle-end/100571] bogus -Wstringop-overflow with VLA of elements larger than byte
  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
                   ` (3 preceding siblings ...)
  2021-05-12 21:51 ` msebor at gcc dot gnu.org
@ 2021-05-12 21:59 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:db514f98a383b2ebdcfe74feb80f98f406cec174

commit r12-756-gdb514f98a383b2ebdcfe74feb80f98f406cec174
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed May 12 15:57:34 2021 -0600

    Add test for PR middle-end/100571.

    gcc/testsuite:
            PR middle-end/100571
            * gcc.dg/Wstringop-overflow-67.c: New test.

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