From patchwork Sat Nov 18 10:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 166494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1101499vqn; Sat, 18 Nov 2023 02:43:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBgES2ZDwDEf42mGiXspStQShlU3BxWpC3JOGpwXwuUdMfLr+bu6r+5FZE1vsvZz61vKoU X-Received: by 2002:ac8:5e07:0:b0:41b:7771:34aa with SMTP id h7-20020ac85e07000000b0041b777134aamr2782797qtx.55.1700304199831; Sat, 18 Nov 2023 02:43:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700304199; cv=pass; d=google.com; s=arc-20160816; b=iRtj4mb8pAKEtXEvqsXdxFkBfYVR61+7EKUtVsjbTZyPxZlDd9zMImzV63sqW7S9Gr ss4TkAPlLcXSpAOmDZeCareGhluZrQpjOhgFs5smCUzBAXmQRBy9FqHyUyI4T3P2XJf+ HVg/iOPa3dOavcVkjRLQZehRUl7fSr9HX63a9PLfNA9ESdglbtbdPkL88xdMsRZAXPgm i0u2p0seKOFMyGDVXV1z3yv2pnEecFk3Zmhwio0pcNyb9ppNFhHcRbi7dhT1FJd+zJ1h k7tqcVHPXxxu+gCiEavshd/lEkFvY6N8dDzsGUBIFMNujgNeuUNo0XfeWS20N1IuzADf mWsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=CjiuviMmM3J94jTAZ0Dwu3Nn+M++oACZmDAFTbYHp64=; fh=O9o2qXlgB0KmYon22YHlRtYHiDm0GJIwfSlnUe7VflI=; b=T7dagABdJvAVsXGG1Z9MBF8cD5lrzejkC7OSiW4LJycdZLthbUk5UdiszOUvldL1lA znZjGJpG0OmAp1HPgEhbBblFAMOZ/ITSJnYukdBYlIGkx8YPrRCA8D3ZDkcgsuf9pPw5 1roHdz+QXJ0lxJxi3evtoZv5Xs6/n3tpfuehXRGj7CBzzpkMsX2PR9kTacy6N8CE+ldc yZQkmVozhRAdcZCGOAVtg5gagVhJ840UxPNLUbaMBqoSNCY9GJf6nvnMbXQakc13o+fj drJG98L5fUpBBXcYzXo6PF4aD7Gop1f0P6UcwJYfZ6wbFdFcH3qf2J4RnPLPIJzlcXMA afQA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=WyRVhwmu; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n16-20020ac85a10000000b004181a080726si3571491qta.659.2023.11.18.02.43.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 02:43:19 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=WyRVhwmu; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98A7C3858434 for ; Sat, 18 Nov 2023 10:43:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 8A49E3858D38 for ; Sat, 18 Nov 2023 10:42:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A49E3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A49E3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700304176; cv=none; b=fddTTnUWyJAeDSxkGyDGHPryezE/SP0AF4QgZwOctGqvKG/d/AbaTAx5SCr/dtg94Mw/9LpsrMKjQxokXOQnDIG8tJTZn1OUFmmBeBBjOxXK1apQPlp219VIXP6OvNzC4k+9Ad1Hvzw2DeVtz842YHSOquUXa5Jn60na74FDAEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700304176; c=relaxed/simple; bh=UsTi0vH8YfpckQyUe/XGcb/8FSZJ+v1LZRDF5EMCi/0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=clArGzDocC3zmMaUwSHDFA8RottOUJo3slFE2PCBlfP2CuTJyy7eF0Un+ZzJtQ5EXmhNgIldQYMw6CYdf9MJ2m+7w6+KXah7hSjjZj2hJGtzG6OwvZ7qV3YlnDZ7WZqfzzE6n9w33bTDu4R6wbJuNHwYYmS8cyU9jm/NLveJK8Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6d648679605so1534833a34.1 for ; Sat, 18 Nov 2023 02:42:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1700304174; x=1700908974; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CjiuviMmM3J94jTAZ0Dwu3Nn+M++oACZmDAFTbYHp64=; b=WyRVhwmuN0jzJ4D35EEzFkf9kLjCDYm1ZbeCZZJFWjmkX8VEZVckkQpRKZpINEWaEc 5NMpLfiCEkBsXBg8e/vi89Bn69ZDnBQoWkVNf1dJ3IV6uFucbcw87v3wQO7JlHbDmMcp yw62gBDcPpZ5E7/Q3uzNSui8krsyl4LPDe7cx/P+Iml7JD/Zj+QNcVk+47kUcnPNd2rG vZDPrG39bQ0YKVMBkS/mBN9gD4JEU1zg5lpyU3ENJfU32sPZl8kIN1ypb7LUVZkoY3aR 0HLA3ghZRPawf2x/XyveHCrfXKNbJBO1D5HpHyMOGYHCEkmw4hOr5KfVnfnCZgSfNAUh izuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700304174; x=1700908974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CjiuviMmM3J94jTAZ0Dwu3Nn+M++oACZmDAFTbYHp64=; b=LVvEk/0DGykkMQ/VQUrLSn/CBp/LERp4+jIGFBIgBt/qnrrZU8QKAE7HMkq5r/YxyA oFesAAiWmxZx3dy9aAxhxUN6DLw7yQ2c791Mq3S2pdwIJT0xKVbqcGtlY98yZ5VEajBU Gsg3z/FOEoZsGLr6KG1pZkCuE6bIc8aVOdU27FHv/FUoMCnArw1qudeWnYgBAOEIuWKT W9RV7tgl4hBhiLh5IRP3uPbd9Vq+Np0Dx8XKOFyR8VUx1bMxacr6yomdIOGL5Sq4DS2Z k2bNQRbvTokjhXBDde/XjM/QH8WotK6RIL23WR/pZNy2oOjUICKO7XqHv2teAH2SkbSA pdFg== X-Gm-Message-State: AOJu0Yx1YEq0Df74Wbx5uvmGfl1u1aGF9KjH8O4nVGIEra/nEC9bWwXr NHjml9U2G66gv9I1XbuKphLvBBFU9D+iBw+1fn4TFiU+T2Fght6M1CyeF5e0N4SX6AvmE3V7wxH IrMAP5E5qoCDwIDLa46+0IlZDlY8NMljMzEuDTs4RDGIt3FILSL4VkDtEVZWftlbkL6rlRhTFLF d8O6A= X-Received: by 2002:a05:6870:910b:b0:1e9:c59b:a9ad with SMTP id o11-20020a056870910b00b001e9c59ba9admr2215169oae.52.1700304173710; Sat, 18 Nov 2023 02:42:53 -0800 (PST) Received: from hsinchu02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id m12-20020a1709026bcc00b001cc47c1c29csm2756774plt.84.2023.11.18.02.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 02:42:53 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com Cc: Kito Cheng Subject: [committed] RISC-V: Fix mismatched new delete for unique_ptr Date: Sat, 18 Nov 2023 18:42:48 +0800 Message-Id: <20231118104248.11513-1-kito.cheng@sifive.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782898176682658741 X-GMAIL-MSGID: 1782898176682658741 gcc/ChangeLog: * config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::parse_arch): Use char[] for std::unique_ptr to prevent mismatched new delete issue. (riscv_process_one_target_attr): Ditto. (riscv_process_target_attr): Ditto. --- gcc/config/riscv/riscv-target-attr.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv-target-attr.cc b/gcc/config/riscv/riscv-target-attr.cc index 78f259d0c96..c4bd99d8632 100644 --- a/gcc/config/riscv/riscv-target-attr.cc +++ b/gcc/config/riscv/riscv-target-attr.cc @@ -105,7 +105,7 @@ riscv_target_attr_parser::parse_arch (const char *str) { /* Parsing the extension list like "+[,+]*". */ size_t len = strlen (str); - std::unique_ptr buf (new char[len]); + std::unique_ptr buf (new char[len]); char *str_to_check = buf.get (); strcpy (str_to_check, str); const char *token = strtok_r (str_to_check, ",", &str_to_check); @@ -241,7 +241,7 @@ riscv_process_one_target_attr (char *arg_str, return false; } - std::unique_ptr buf (new char[len]); + std::unique_ptr buf (new char[len]); char *str_to_check = buf.get(); strcpy (str_to_check, arg_str); @@ -327,7 +327,7 @@ riscv_process_target_attr (tree args, location_t loc, struct gcc_options *opts) return false; } - std::unique_ptr buf (new char[len]); + std::unique_ptr buf (new char[len]); char *str_to_check = buf.get (); strcpy (str_to_check, TREE_STRING_POINTER (args));