From patchwork Wed Aug 2 10:29:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1815948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Pq3OoYKE; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RG7Wy4bc1z1ybS for ; Wed, 2 Aug 2023 20:29:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93DB93858284 for ; Wed, 2 Aug 2023 10:29:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93DB93858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690972188; bh=Piq8O6+HfKiBA+5hX+DfkwKXNWUU1QEBucs348ko8eA=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Pq3OoYKEg6TIxuS8XJyy5XNVekE8Du3zzijrqsnIPm/7TWkkQgunz8IHif58839Kq KXgCSkQLN4umScOCy+v1rgmdHWrsbz+lzqvuiCYze7Dejkv7RvKhRNW/viomp7TqKW 7wPMoSZ01k7JQeip25+dXl5oDMYkllCStkfvKCKA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2044.outbound.protection.outlook.com [40.107.105.44]) by sourceware.org (Postfix) with ESMTPS id 8C3B13858D1E for ; Wed, 2 Aug 2023 10:29:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C3B13858D1E Received: from AM9P250CA0022.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::27) by GV1PR08MB8620.eurprd08.prod.outlook.com (2603:10a6:150:84::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Wed, 2 Aug 2023 10:29:24 +0000 Received: from AM7EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:21c:cafe::4) by AM9P250CA0022.outlook.office365.com (2603:10a6:20b:21c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45 via Frontend Transport; Wed, 2 Aug 2023 10:29:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT055.mail.protection.outlook.com (100.127.141.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45 via Frontend Transport; Wed, 2 Aug 2023 10:29:24 +0000 Received: ("Tessian outbound ba2f3d95109c:v145"); Wed, 02 Aug 2023 10:29:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f5a4354e26f4a5b4 X-CR-MTA-TID: 64aa7808 Received: from fd717ebdd5dd.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 204FABC3-9595-4CC0-A292-A61895D2BFCC.1; Wed, 02 Aug 2023 10:29:17 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd717ebdd5dd.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 02 Aug 2023 10:29:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VSCKra0vcTGMU4Cg0CUCDkDXHeNaIH6pTGAtjdyb2PaS1yVRwXxPtlzdlU2SfrBWje5bNwFRvMAzDAZzMQwpkiqtTLpgr3Lx5a5h5ugzvhYJqaM+epODnHejiYi0HWtwzjgyQgFcyODTIsb1Dl5A27M0C4W6GyhqMezYj4CQQA0kC6C9Sb0Zl30xcmDjC6BJAntb2xJWTcj/lQ22rUR+qbQLzeFkD6zP9b+fAlKw/dzvDqUIHYzmSq63Arpv7eFs5GZbHL06W4FTeuG6pOG8XMe2JSi64qQ/5GGCXg3+5t9Ed4iyxuiy1ak9aZOUNbwMhhhvtxX/WRt+On6LZrmDjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Piq8O6+HfKiBA+5hX+DfkwKXNWUU1QEBucs348ko8eA=; b=Dd/K5qCY7POMvtypu8+ZbK00mwJ1Cm82uWzYtVQmARIYMvoX7Db90+HcOiAYfoqrWd7MpPqhp5tTUSLXaszmDomhcwrt1bgHXA0JrG7aEeIC717EIYuwFWDIpbB6RXk4+fOgIgp7sLiQk/N74yANnoSakF3BaSvjahUAjZFI1rqwQLa+gpC87JYe5hnpUSNcBoRr285gMkJ9/QrDEgQcJ0WzgXosIfZ7u8em3WKnG7qmd+B/FrRsXpiS4nqvLhcq9jsTkuH+QUF9UU85e+V/gr5Mmj3vMUttsK4YQp8ZO4ej4X+O6KPSNu1yHgETTsmLNRGypOXqyurzisBoTyKVag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DBBPR08MB6249.eurprd08.prod.outlook.com (2603:10a6:10:203::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Wed, 2 Aug 2023 10:29:11 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::a85:6d3:5dd7:7d3]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::a85:6d3:5dd7:7d3%7]) with mapi id 15.20.6631.045; Wed, 2 Aug 2023 10:29:11 +0000 Date: Wed, 2 Aug 2023 11:29:08 +0100 To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, richard.sandiford@arm.com Subject: [PATCH][gensupport]: Don't segfault on empty attrs list Message-ID: Content-Disposition: inline X-ClientProxiedBy: LNXP265CA0080.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::20) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DBBPR08MB6249:EE_|AM7EUR03FT055:EE_|GV1PR08MB8620:EE_ X-MS-Office365-Filtering-Correlation-Id: ffb7e443-a173-43e6-2272-08db9343579a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ILaxCiSWADeag6xjjthI79ZQjAD7GI3fpawtmWFVEYeEEd+Bd+fdxtX5PS2a2y7PQdZ4xfWC9jG225OP6GUuMsfyzWor9nLxCbmPh0kURyotFLy+KjS7rocMfLC82lBNx4wBelvZ8hi8xWiJPgq5WjmwuZub7j9d5KQxkK6ZV1a443lM/HIk3t5hzxO0I8bk3gT9qd/68mMaIBnm26XwSbZF0m30K+aGMT0X0oJxGbSGPZs5VT2TyRTdUwNJod6Q5trsC4nM2qhSiMCod7fZONsfg0xkPHYtPtVVWgpupNZDLUsH0lmmIy2lbvmAno4EgoBk43H63DxrHCypm21G5lKZ+9fUUsazb9SLvw4HNF9S0buPTTbMkrxrtoWpCQnCYTOOYRCTy1wRjT7GrJfWoUXIfiEDIdmJCdvV+iCYvY/H2e31OuC/fYvivF0NWB6RL0y1OobdqCIi3DnuILzkqBtHByJTbW6ZdWOceUZsEH+tBCKLXvGz8+CTcpIYA9XM/SLpIux10eQbyGSeLb36yr1iiSe/jIkaV6SADMuj7R882lt1Fx5qK+WusTC2xFnzi6LI28XnIMpnjgL+wQleeNLewSGJV1488OtXielPFSnoJzzYQsv3oSpLdHJbaG9egvDPKW2ionynQyfc6r6t8w== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(136003)(366004)(376002)(39860400002)(451199021)(235185007)(8936002)(8676002)(5660300002)(26005)(41300700001)(2906002)(44832011)(36756003)(4743002)(2616005)(478600001)(38100700002)(316002)(86362001)(6506007)(6486002)(33964004)(66946007)(66556008)(66476007)(44144004)(6666004)(4326008)(6916009)(186003)(6512007)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6249 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a25f4e19-7fe8-4159-cbee-08db93434f74 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FDnip7Rdd27OOdSDxSNnoLG0LkBisqRs9dJnBUL5HyPrABQZWf9Nd+ky6j6764rob5UwzHs63P2A7jFlFT1tzcVQNddeO2SKFnrbAkt9hJTh8KZzeaTwgGOyK/eMZwysZ4T0K+PTBPHOp9GNiCpRVaLhmic8Ou5u6IGZt1hOcxZaBUsGFgHQIfNT4AQ8cNaFN7hu/riGCvr7wxwvjV2V36qZmIdVS30EOMyMyyeYN52wcdF7vSP9kPPDlvMmE8OKQN3VfyFajICK+eJTWLAWiXq0SwOVu7BKr1Ur4X3PMMPddX+eCJDpZNdSUtN76cpEAs2hBGL7Myw3WxuwR8kswdYCazjftUc9CReEHe4jygu5lXqfyv9DIeGFhxeW9GpPRyrGk072LNUvPRTakGB/w/PId33flYll01IIAvmcvuSYU7v/BDLx061KyiRFcVlBFXUpgkU0h+0uALlBFZCpYC58hvaAvL15wc0LRfx00BLYJtx95KUOikXsIy54kqn7QnKO+BmRqdI4jTxaqpIhmshupth5jJYWjZF+VL7/1bfI3TyXB570BKAaQC0C11DukdXzFw+O+xTRxyy71Hp2W/qZKg2UBP3yBK7/K/7Y2MMYY19o5ZbS9PqRpBCxw4iPLtvHdBIWEX+JLoOMK6vlRTXJ+YRyp9mtA7ar3/WfQYOPjy3Ivmt3hMAOEABAoiebG+Udfk1+2DLjc23xkaiu+WYCb8Y64DfGv9h0uGbTvBxHvdpXzmZEkJhQyl2+g4mKaEZRXepVChsY/BzJYMpTEOVlegO73NJJVjsxUS9H/gs= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(396003)(376002)(346002)(82310400008)(451199021)(36840700001)(40470700004)(46966006)(44832011)(6512007)(47076005)(36860700001)(33964004)(6486002)(44144004)(36756003)(4743002)(40460700003)(40480700001)(2616005)(26005)(6506007)(336012)(186003)(70206006)(70586007)(81166007)(356005)(41300700001)(82740400003)(86362001)(4326008)(235185007)(5660300002)(8676002)(8936002)(316002)(6916009)(2906002)(6666004)(478600001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2023 10:29:24.4399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffb7e443-a173-43e6-2272-08db9343579a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8620 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, Currently we segfault when len == 0 for an attribute list. essentially [cons: =0, 1, 2, 3; attrs: ] segfaults but should be equivalent to [cons: =0, 1, 2, 3] and [cons: =0, 1, 2, 3; attrs:]. This fixes it by just returning early and leaving it to the validators whether this should error out or not. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * gensupport.cc (conlist): Support length 0 attribute. --- inline copy of patch -- diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc index 959d1d9c83cf397fcb344e8d3db0f339a967587f..5c5f1cf4781551d3db95103c19cd1b70d98f4f73 100644 --- diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc index 959d1d9c83cf397fcb344e8d3db0f339a967587f..5c5f1cf4781551d3db95103c19cd1b70d98f4f73 100644 --- a/gcc/gensupport.cc +++ b/gcc/gensupport.cc @@ -619,6 +619,9 @@ public: [ns..ns + len) should equal XSTR (rtx, 0). */ conlist (const char *ns, unsigned int len, bool numeric) { + if (len == 0) + return; + /* Trim leading whitespaces. */ while (ISBLANK (*ns)) { --- a/gcc/gensupport.cc +++ b/gcc/gensupport.cc @@ -619,6 +619,9 @@ public: [ns..ns + len) should equal XSTR (rtx, 0). */ conlist (const char *ns, unsigned int len, bool numeric) { + if (len == 0) + return; + /* Trim leading whitespaces. */ while (ISBLANK (*ns)) {