From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DFF66386186A; Mon, 7 Sep 2020 23:15:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFF66386186A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599520542; bh=SYtVXj7ccxa+zVR8melBmD+Id6g3GsKVS/H/a0vl1oI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SPmEju+ku230THLp2g5WWMo65gePkFY3VhLs/NkEPE17N/z4YyEd09ZiLEX+qF8sV Keesg7R196dx+bI80pGbGNLYKOZ5XKW6qSs1PJULOKNaKKvOm1phtY2x+xbDRx7yii rdQF/Sm53lRFmdTaUWlzqoAWsOKpzciDoKJoR0Cg= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96963] -Wstringop-overflow false positive on -O3 or -O2 -ftree-vectorize when assigning consecutive char struct members Date: Mon, 07 Sep 2020 23:15:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status keywords cf_reconfirmed_on everconfirmed blocked see_also cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2020 23:15:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96963 Martin Sebor 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=3D93200 CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor --- Confirmed. The vectorizer replaces the two character assignments with a st= ore 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=3D/dev/stdout pr96963.c ;; Function clr (clr, funcdef_no=3D0, decl_uid=3D1937, cgraph_uid=3D1, symbol_order=3D0) ;; 1 loops found ;; ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 ;; 2 succs { 1 } pr96963.c: In function =E2=80=98clr=E2=80=99: pr96963.c:11:14: warning: writing 2 bytes into a region of size 1 [-Wstringop-overflow=3D] 11 | f->a =3D 0; | ~~~~~^~~ pr96963.c:3:14: note: at offset 0 to object =E2=80=98a=E2=80=99 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; [local count: 1073741824]: _1 =3D &f_2(D)->a; heh (_1); MEM [(char *)_1] =3D { 0, 0 }; <<< _1 points to f_2(D)= ->a return; } Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings=