public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts
@ 2022-05-28 19:24 roland at gnu dot org
  2022-05-30  9:25 ` [Bug middle-end/105762] [12/13 " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: roland at gnu dot org @ 2022-05-28 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105762
           Summary: [12 Regression] -Warray-bounds false positives for
                    integer-to-pointer casts
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland at gnu dot org
  Target Milestone: ---

This code:

```
void crash(void) {                                                              
  volatile int* ptr = (volatile int*)1ul;                                       
 *ptr = 1;                                                                      
}
```

now gets:

```
warning: array subscript 0 is outside array bounds of 'volatile int[0]'
[-Warray-bounds]
```

This is a regression since GCC 11.

Reproduced on aarch64-elf and x86_64-elf targets as of 12 branch commit
2c11a9a380e7af333e19d6e576a889646d699b2a

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
@ 2022-05-30  9:25 ` rguenth at gcc dot gnu.org
  2022-05-30 10:06 ` [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-30  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression]             |[12/13 Regression]
                   |-Warray-bounds false        |-Warray-bounds false
                   |positives for               |positives for
                   |integer-to-pointer casts    |integer-to-pointer casts
   Target Milestone|---                         |12.2
             Blocks|                            |56456
           Keywords|                            |diagnostic


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
[Bug 56456] [meta-bug] bogus/missing -Warray-bounds

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
  2022-05-30  9:25 ` [Bug middle-end/105762] [12/13 " rguenth at gcc dot gnu.org
@ 2022-05-30 10:06 ` marxin at gcc dot gnu.org
  2022-05-31 14:42 ` msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-30 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
            Summary|[12/13 Regression]          |[12/13 Regression]
                   |-Warray-bounds false        |-Warray-bounds false
                   |positives for               |positives for
                   |integer-to-pointer casts    |integer-to-pointer casts
                   |                            |since
                   |                            |r12-2132-ga110855667782dac
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-30

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-2132-ga110855667782dac.

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
  2022-05-30  9:25 ` [Bug middle-end/105762] [12/13 " rguenth at gcc dot gnu.org
  2022-05-30 10:06 ` [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac marxin at gcc dot gnu.org
@ 2022-05-31 14:42 ` msebor at gcc dot gnu.org
  2022-08-04 15:12 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-05-31 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=99578
             Status|NEW                         |RESOLVED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
There is no object at address 1 (or at any "made up" address) so dereferencing
that address is undefined.  The warning is designed to detect accesses at
nonzero offsets from null (e.g., p->x or p[i]).  It was relaxed to accommodate
a subset of the use cases where the offset is above 4k (see pr99578).

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
                   ` (2 preceding siblings ...)
  2022-05-31 14:42 ` msebor at gcc dot gnu.org
@ 2022-08-04 15:12 ` pinskia at gcc dot gnu.org
  2022-08-05 10:34 ` vanyacpp at gmail dot com
  2022-09-13 16:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-04 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wrenger at sra dot uni-hannover.de

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 106526 has been marked as a duplicate of this bug. ***

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
                   ` (3 preceding siblings ...)
  2022-08-04 15:12 ` pinskia at gcc dot gnu.org
@ 2022-08-05 10:34 ` vanyacpp at gmail dot com
  2022-09-13 16:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vanyacpp at gmail dot com @ 2022-08-05 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

Ivan Sorokin <vanyacpp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vanyacpp at gmail dot com

--- Comment #4 from Ivan Sorokin <vanyacpp at gmail dot com> ---
Perhaps the warning message could be improved? The warning is saying about
arrays but there are no arrays in the original code.

I think it would be great if the warning said something about
{invalid/wild/cast from int} pointer. English is not my strong suit, perhaps
something like this:

warning: dereferencing wild pointer '(int*)1ul' is undefined

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

* [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac
  2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
                   ` (4 preceding siblings ...)
  2022-08-05 10:34 ` vanyacpp at gmail dot com
@ 2022-09-13 16:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-13 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |npfhrotynz-ptnqh.myvf@noclu
                   |                            |e.notk.org

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 106920 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-09-13 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 19:24 [Bug middle-end/105762] New: [12 Regression] -Warray-bounds false positives for integer-to-pointer casts roland at gnu dot org
2022-05-30  9:25 ` [Bug middle-end/105762] [12/13 " rguenth at gcc dot gnu.org
2022-05-30 10:06 ` [Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac marxin at gcc dot gnu.org
2022-05-31 14:42 ` msebor at gcc dot gnu.org
2022-08-04 15:12 ` pinskia at gcc dot gnu.org
2022-08-05 10:34 ` vanyacpp at gmail dot com
2022-09-13 16:48 ` 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).