Bug 108074 - [11/12 Regression] Incorrect stringop-overflow warning
Summary: [11/12 Regression] Incorrect stringop-overflow warning
Status: RESOLVED DUPLICATE of bug 104162
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 12.2.0
: P3 normal
Target Milestone: 11.4
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, needs-bisection
Depends on:
Blocks: Wstringop-overflow
  Show dependency treegraph
 
Reported: 2022-12-12 12:37 UTC by Alastair Irving
Modified: 2022-12-12 13:32 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Reproducer (148 bytes, text/plain)
2022-12-12 12:37 UTC, Alastair Irving
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair Irving 2022-12-12 12:37:51 UTC
Created attachment 54071 [details]
Reproducer

Compiling with -O2 or higher I get an incorrect warning:
test.c: In function ‘foo3’:                                                                                             
test.c:15:5: warning: ‘foo’ accessing 16 bytes in a region of size 8 [-Wstringop-overflow=]                             
 
This doesn't appear at lower optimization levels.  It's also very sensative to the function, for example removing the return on the next line makes the warning go away.
Comment 1 Richard Biener 2022-12-12 12:57:04 UTC
This has been fixed on trunk and is likely a duplicate.
Comment 2 Martin Liška 2022-12-12 13:32:12 UTC
Dup.

*** This bug has been marked as a duplicate of bug 104162 ***