https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96963
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |diagnostic
Last reconfirmed| |2020-09-07
Ever confirmed|0 |1
Blocks| |88443
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93200
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. The vectorizer replaces the two character assignments with a store
into f->a. The fix for pr93200 added a hack to handle some these cases but not
this one. This instance of the warning is issued from the strlen pass whose
dump shows the cause of the problem:
$ gcc -O3 -S -Wall -fdump-tree-strlen=/dev/stdout pr96963.c
;; Function clr (clr, funcdef_no=0, decl_uid=1937, cgraph_uid=1,
symbol_order=0)
;; 1 loops found
;;
;; Loop 0
;; header 0, latch 1
;; depth 0, outer -1
;; nodes: 0 1 2
;; 2 succs { 1 }
pr96963.c: In function ‘clr’:
pr96963.c:11:14: warning: writing 2 bytes into a region of size 1
[-Wstringop-overflow=]
11 | f->a = 0;
| ~~~~~^~~
pr96963.c:3:14: note: at offset 0 to object ‘a’ with size 1 declared here
3 | char a;
| ^
clr (struct foo * f)
{
vector(2) char * vectp.4;
vector(2) char * vectp_f.3;
char * _1;
<bb 2> [local count: 1073741824]:
_1 = &f_2(D)->a;
heh (_1);
MEM <vector(2) char> [(char *)_1] = { 0, 0 }; <<< _1 points to f_2(D)->a
return;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
[Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings