{"id":2232025,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232025/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/afW42S_A57vBcCrN@tucnak/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<afW42S_A57vBcCrN@tucnak>","date":"2026-05-02T08:42:01","name":"[cmmitted,16] strlen: Fix up backport [PR125079]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"31935a78a956b357da9859073e270c9fd21c9efe","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.1/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/afW42S_A57vBcCrN@tucnak/mbox/","series":[{"id":502520,"url":"http://patchwork.ozlabs.org/api/1.1/series/502520/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502520","date":"2026-05-02T08:42:01","name":"[cmmitted,16] strlen: Fix up backport [PR125079]","version":1,"mbox":"http://patchwork.ozlabs.org/series/502520/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232025/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232025/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Nxxr2LZx;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Nxxr2LZx","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g71cw3Z5Yz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 18:42:39 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 3F4094A99317\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  2 May 2026 08:42:37 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 5DEE34A99317\n for <gcc-patches@gcc.gnu.org>; Sat,  2 May 2026 08:42:08 +0000 (GMT)","from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-Wk0YfEC-Nd-wL5PgU2o3Gw-1; Sat,\n 02 May 2026 04:42:06 -0400","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 6C55519560B5\n for <gcc-patches@gcc.gnu.org>; Sat,  2 May 2026 08:42:05 +0000 (UTC)","from tucnak.zalov.cz (unknown [10.44.34.21])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id C82621955D84\n for <gcc-patches@gcc.gnu.org>; Sat,  2 May 2026 08:42:04 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 6428g1hB2236386\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Sat, 2 May 2026 10:42:02 +0200","(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 6428g1fq2236385\n for gcc-patches@gcc.gnu.org; Sat, 2 May 2026 10:42:01 +0200"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 3F4094A99317","OpenDKIM Filter v2.11.0 sourceware.org 5DEE34A99317"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 5DEE34A99317","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 5DEE34A99317","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777711328; cv=none;\n b=wryGIUGHJmSZTzucsWsBw8BYsrd5EQIBVahvQy6cHUWDlrPVCEapx5tKz6cWjyjdzRA6asSg2PkzwgZOLiMbefMLdXuAP4evLmGocvxVk93vLHh/PrOWhl8ucwNNYhp4FREwGGEbr0esWaxB6x8YPSkpHRPnjzyVYwWVP2FiXPA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777711328; c=relaxed/simple;\n bh=lA724tXx1yFmWZX8vszyFnzQU8euoOkaZoI/fVRWyzo=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=R8IFfY20ZwqNTlaCAF9T6LIC/X2dcNLLjow9lnADqdQCBIEIGCB+jTykRRAhx8wGGghQU2Jt8Y7WbVmyYD5broRUE6wJpdfSqsgvtNtJ/+DmCEm4tK4TkXm7qG9bkuAdKNNmcdM+wkeMgku4NFShNXrhGoz7GI6J4B/xts7RCIs=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777711327;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:mime-version:mime-version:\n content-type:content-type; bh=HCcLn4z2wEEtcnYLxx/bOhmomO4vh44Gi2hr4SahVec=;\n b=Nxxr2LZxNElDwqoPBj51+FJOCgmSpWZPzow9e2iSDljvUesBgoiObaI/KIH2MF8yQy4Vp7\n oplVar1/YKymBdAgnGsMIRy3BnCVRi2LZjkN9CXdhBNGOVjYYUONWJ7DwaRxQvopOFCq3Z\n d4odh0EefLNbDwlnaPxYpWEDMlCnu1k=","X-MC-Unique":"Wk0YfEC-Nd-wL5PgU2o3Gw-1","X-Mimecast-MFC-AGG-ID":"Wk0YfEC-Nd-wL5PgU2o3Gw_1777711325","Date":"Sat, 2 May 2026 10:42:01 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[cmmitted][16] strlen: Fix up backport [PR125079]","Message-ID":"<afW42S_A57vBcCrN@tucnak>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"1YZ1AScosphen-e5zl35YSBMxH3A3ePtiebv1h8cBAo_1777711325","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Hi!\n\nMy r16-8848 backport of r17-251 broke some __strcat_chk optimizations.\nThe problem is that GCC 16 branch differs from the trunk since r17-82,\non the trunk lenstmt is really the call stmt and r17-251 then asks for\nthe call lhs of that, but before r17-82 lenstmt has been resued for the\nsubsequent gimple assign and so objsz is NULL_TREE.\n\nFixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,\ncommitted to 16 branch as obvious.\n\n2026-05-02  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR tree-optimization/125079\n\t* tree-ssa-strlen.cc (get_string_length): Don't overwrite\n\tlenstmt variable with another stmt.\n\n\n\tJakub","diff":"--- gcc/tree-ssa-strlen.cc.jj\t2026-05-01 14:56:28.322882547 +0200\n+++ gcc/tree-ssa-strlen.cc\t2026-05-01 21:53:56.978672178 +0200\n@@ -848,7 +848,7 @@ get_string_length (strinfo *si)\n      attempt to compute the length from the call statement.  */\n   if (si->stmt)\n     {\n-      gimple *stmt = si->stmt, *lenstmt = NULL;\n+      gimple *stmt = si->stmt, *lenstmt = NULL, *g;\n       tree callee, lhs, fn, tem;\n       location_t loc;\n       gimple_stmt_iterator gsi;\n@@ -883,11 +883,11 @@ get_string_length (strinfo *si)\n               lhs = force_gimple_operand_gsi (&gsi, lhs, true, NULL_TREE,\n                                               true, GSI_SAME_STMT);\n             }\n-\t  lenstmt = gimple_build_assign\n+\t  g = gimple_build_assign\n \t\t\t(make_ssa_name (TREE_TYPE (gimple_call_arg (stmt, 0))),\n \t\t\t POINTER_PLUS_EXPR,tem, lhs);\n-\t  gsi_insert_before (&gsi, lenstmt, GSI_SAME_STMT);\n-\t  gimple_call_set_arg (stmt, 0, gimple_assign_lhs (lenstmt));\n+\t  gsi_insert_before (&gsi, g, GSI_SAME_STMT);\n+\t  gimple_call_set_arg (stmt, 0, gimple_assign_lhs (g));\n \t  lhs = NULL_TREE;\n \t  /* FALLTHRU */\n \tcase BUILT_IN_STRCPY:\n","prefixes":["cmmitted","16"]}