public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110458] New: -Warray-bounds=2 new false positive
@ 2023-06-28 15:09 sirl at gcc dot gnu.org
2023-06-28 19:21 ` [Bug tree-optimization/110458] " pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: sirl at gcc dot gnu.org @ 2023-06-28 15:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
Bug ID: 110458
Summary: -Warray-bounds=2 new false positive
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sirl at gcc dot gnu.org
Target Milestone: ---
Created attachment 55412
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55412&action=edit
testcase
Since somewhere between r14-1870 and r14-2097 a new -Warray-bounds=2 false
positive is shown for this little testcase:
typedef struct {
unsigned arr1[4];
unsigned arr2[4];
} data;
void f_notok(void *arrayOut) {
int i;
unsigned *arr2;
unsigned *arr1;
data *dataOut;
dataOut = (data *)arrayOut;
arr1 = dataOut[0].arr1;
arr2 = dataOut[0].arr2;
i = 0;
for (; i < 4; i++) {
arr1[i] = 0;
arr2[i] = 0;
}
}
When compiled with trunk@r2097 "gcc -O2 -W -Wall -Warray-bounds=2 -c
bug-Warray-bounds-eq-2.c" the warning is:
bug-Warray-bounds-eq-2.c: In function 'f_notok':
bug-Warray-bounds-eq-2.c:16:13: warning: '__builtin_memset' offset [16, 31]
from the object at 'arrayOut' is out of the bounds of referenced subobject
'arr1' with type 'unsigned int[4]' at offset 0 [-Warray-bounds=]
16 | arr1[i] = 0;
| ~~~~~~~~^~~
bug-Warray-bounds-eq-2.c:2:12: note: subobject 'arr1' declared here
2 | unsigned arr1[4];
| ^~~~
gcc-13.1.1 and earlier didn't warn here. The attached full testcase also shows
that slight variations in the code silence the warning.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
@ 2023-06-28 19:21 ` pinskia at gcc dot gnu.org
2023-06-29 10:13 ` sirl at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-28 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |tree-optimization
Keywords| |diagnostic
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is ldist does:
arr1_8 = &MEM[(struct data *)arrayOut_7(D)].arr1;
__builtin_memset (arr1_8, 0, 32);
(which is kinda of correct).
I think there are other bug related to this similar thing ...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
2023-06-28 19:21 ` [Bug tree-optimization/110458] " pinskia at gcc dot gnu.org
@ 2023-06-29 10:13 ` sirl at gcc dot gnu.org
2023-06-29 15:54 ` [Bug tree-optimization/110458] [14 Regression] " pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sirl at gcc dot gnu.org @ 2023-06-29 10:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
--- Comment #2 from Franz Sirl <sirl at gcc dot gnu.org> ---
This has been exposed by commit
r14-2013-gfb0447b1f6b7373f57cb3a3d17a46803cfd9909d "Hide IVOPTs strip_offset".
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] [14 Regression] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
2023-06-28 19:21 ` [Bug tree-optimization/110458] " pinskia at gcc dot gnu.org
2023-06-29 10:13 ` sirl at gcc dot gnu.org
@ 2023-06-29 15:54 ` pinskia at gcc dot gnu.org
2023-08-09 9:21 ` sirl at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-29 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|-Warray-bounds=2 new false |[14 Regression]
|positive |-Warray-bounds=2 new false
| |positive
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] [14 Regression] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
` (2 preceding siblings ...)
2023-06-29 15:54 ` [Bug tree-optimization/110458] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-08-09 9:21 ` sirl at gcc dot gnu.org
2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110458] [14/15 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: sirl at gcc dot gnu.org @ 2023-08-09 9:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
--- Comment #3 from Franz Sirl <sirl at gcc dot gnu.org> ---
Actually Comment 2 is only true for the original testcode (which was quite
fragile to reproduce). The reduced testcode started to fail with the backwards
jump threader rewrite in r12-2591-g2e96b5f14e4025691b57d2301d71aa6092ed44bc and
a simple -Warray-bounds. This is proven by the fact that compiling the testcase
with gcc@r12-2591 with an additional --param=threader-mode=legacy makes the
warning go away.
So this bug maybe a duplicate of the other bugs (couldn't find a metabug)
related to r12-2591.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] [14 Regression] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
` (3 preceding siblings ...)
2023-08-09 9:21 ` sirl at gcc dot gnu.org
@ 2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110458] [14/15 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-08 15:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
CC| |law at gcc dot gnu.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/110458] [14/15 Regression] -Warray-bounds=2 new false positive
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
` (4 preceding siblings ...)
2024-03-08 15:29 ` law at gcc dot gnu.org
@ 2024-05-07 7:40 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110458
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |14.2
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-07 7:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 15:09 [Bug c/110458] New: -Warray-bounds=2 new false positive sirl at gcc dot gnu.org
2023-06-28 19:21 ` [Bug tree-optimization/110458] " pinskia at gcc dot gnu.org
2023-06-29 10:13 ` sirl at gcc dot gnu.org
2023-06-29 15:54 ` [Bug tree-optimization/110458] [14 Regression] " pinskia at gcc dot gnu.org
2023-08-09 9:21 ` sirl at gcc dot gnu.org
2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110458] [14/15 " rguenth 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).