public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102810] New: Bogus Wstringop-overread warning when special (integer) pointer values passed to array parameter of a function
@ 2021-10-18 10:30 ian at abbott dot org
  2021-10-18 15:52 ` [Bug middle-end/102810] [11/12 Regression] Bogus Wstringop-overread passing a smaller array to an array parameter without a bound msebor at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ian at abbott dot org @ 2021-10-18 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102810
           Summary: Bogus Wstringop-overread warning when special
                    (integer) pointer values passed to array parameter of
                    a function
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at abbott dot org
  Target Milestone: ---

I don't know why this code produces a Wstringop-overread warning since it has
nothing to do with string operations.  Also, why is there a warning for
argument 2, but not for argument 1?

extern int foo(const int *a, const int b[]);

#define SPECIAL ((int *)2)

int main(void)
{
    foo(SPECIAL, SPECIAL);
}

int foo(const int a[], const int b[])
{
    return 0;
}

<source>: In function 'main':
<source>:7:5: warning: 'foo' reading 4 bytes from a region of size 0
[-Wstringop-overread]
    7 |     foo(SPECIAL, SPECIAL);
      |     ^~~~~~~~~~~~~~~~~~~~~
<source>:7:5: note: referencing argument 2 of type 'const int *'
<source>:10:5: note: in a call to function 'foo'
   10 | int foo(const int a[], const int b[])
      |     ^~~

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

end of thread, other threads:[~2023-05-29 10:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 10:30 [Bug c/102810] New: Bogus Wstringop-overread warning when special (integer) pointer values passed to array parameter of a function ian at abbott dot org
2021-10-18 15:52 ` [Bug middle-end/102810] [11/12 Regression] Bogus Wstringop-overread passing a smaller array to an array parameter without a bound msebor at gcc dot gnu.org
2021-10-22 21:44 ` pinskia at gcc dot gnu.org
2022-01-19  7:55 ` rguenth at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` [Bug middle-end/102810] [11/12/13/14 " jakub 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).