public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104657] New: array subscript 0 is outside array bounds
@ 2022-02-23 10:18 christophm30 at gmail dot com
  2022-02-23 10:36 ` [Bug tree-optimization/104657] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: christophm30 at gmail dot com @ 2022-02-23 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104657
           Summary: array subscript 0 is outside array bounds
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christophm30 at gmail dot com
  Target Milestone: ---

Compiling the following code:

void foo(unsigned long v)
{
        volatile unsigned long *p;
        p = (void *)0x8;
        *p = v;
}

with GCC master and "-O2 -Wall" results in the following warning:

$ gcc -O2 -Wall  -c array_subscript_0.c 
array_subscript_0.c: In function 'foo':
array_subscript_0.c:5:9: warning: array subscript 0 is outside array bounds of
'volatile long unsigned int[0]' [-Warray-bounds]
    5 |         *p = v;
      |         ^~

This warning is unexpected and is not triggered by earlier versions of GCC.

Possibly related: pr101977

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

end of thread, other threads:[~2022-02-23 22:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 10:18 [Bug tree-optimization/104657] New: array subscript 0 is outside array bounds christophm30 at gmail dot com
2022-02-23 10:36 ` [Bug tree-optimization/104657] " pinskia at gcc dot gnu.org
2022-02-23 11:14 ` christophm30 at gmail dot com
2022-02-23 18:16 ` msebor at gcc dot gnu.org
2022-02-23 22:17 ` christophm30 at gmail dot com
2022-02-23 22:35 ` christophm30 at gmail dot com

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