From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A9A83384F012; Wed, 14 Jul 2021 17:43:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9A83384F012 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/101455] New: missing -Wstringop-overflow on buffer overflow by a complex number Date: Wed, 14 Jul 2021 17:43:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Wed, 14 Jul 2021 17:43:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101455 Bug ID: 101455 Summary: missing -Wstringop-overflow on buffer overflow by a complex number Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The store in the function below overflows the buffer and should be diagnose= d by -Wstringop-overflow (which is enabled by default) but isn't. It's only diagnosed by -Warray-bounds (which is included in -Wall). $ cat a.c && gcc -O2 -S -fdump-tree-strlen=3D/dev/stdout a.c void* f (double x, double i) { _Complex double *p =3D __builtin_malloc (sizeof (double)); *p =3D __builtin_complex (x, i); return p; } ;; Function f (f, funcdef_no=3D0, decl_uid=3D1944, cgraph_uid=3D1, symbol_o= rder=3D0) ;; 1 loops found ;; ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 ;; 2 succs { 1 } void * f (double x, double i) { complex double * p; [local count: 1073741824]: p_3 =3D __builtin_malloc (8); REALPART_EXPR <*p_3> =3D x_4(D); IMAGPART_EXPR <*p_3> =3D i_5(D); return p_3; }=