From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6724 invoked by alias); 20 Nov 2014 09:31:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6614 invoked by uid 48); 20 Nov 2014 09:31:17 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63989] New: tree-ssa-strlen.c doesn't handle constant pointer plus and array refs if constant offset is smaller than known constant string length Date: Thu, 20 Nov 2014 09:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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 cc dependson blocked 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-SW-Source: 2014-11/txt/msg02157.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D63989 Bug ID: 63989 Summary: tree-ssa-strlen.c doesn't handle constant pointer plus and array refs if constant offset is smaller than known constant string length Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: dimhen at gmail dot com, jakub at gcc dot gnu.org, nheghathivhistha at gmail dot com, rguenth at gcc dot g= nu.org, trippels at gcc dot gnu.org Depends on: 61773 Blocks: 63787 +++ This bug was initially created as a clone of Bug #61773 +++ char *foo (void) { char *p =3D __builtin_malloc (64); char *q =3D __builtin_malloc (64); __builtin_strcat (q, "abcde"); __builtin_strcat (p, "ab"); p[1] =3D q[3]; __builtin_strcat (p, q); return q; } gives > ../../obj2/gcc/cc1 -quiet -O2 t.c t.c: In function =E2=80=98foo=E2=80=99: t.c:1:7: internal compiler error: in get_string_length, at tree-ssa-strlen.c:417 char *foo (void) ^ 0x876c3d2 get_string_length /space/rguenther/tramp3d/trunk/gcc/tree-ssa-strlen.c:417 0x8772b02 get_string_length /space/rguenther/tramp3d/trunk/gcc/tree.h:2731 0x8772b02 handle_builtin_strlen /space/rguenther/tramp3d/trunk/gcc/tree-ssa-strlen.c:899 (gdb) up #1 0x0876c3d3 in get_string_length (si=3D0x3c) at /space/rguenther/tramp3d/trunk/gcc/tree-ssa-strlen.c:417 417 gcc_assert (builtin_decl_implicit_p (BUILT_IN_STPCPY)); while trying to write a testcase that shows that handle_char_store should handle a character copy from a known non-zero value. Well, while really trying to incrementally teach handle_char_store to handle arbitrary stores. >>From gcc-bugs-return-467687-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 20 09:44:40 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 14002 invoked by alias); 20 Nov 2014 09:44:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 13906 invoked by uid 48); 20 Nov 2014 09:44:34 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63989] tree-ssa-strlen.c doesn't handle constant pointer plus and array refs if constant offset is smaller than known constant string length Date: Thu, 20 Nov 2014 09:44:00 -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: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg02159.txt.bz2 Content-length: 289 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63989 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |5.0