From patchwork Fri Sep 30 09:41:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 1582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp395477wrs; Fri, 30 Sep 2022 02:41:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HXohqe3j5R5X3DZHaBBsEfwG/onN35lglQ1GasbIgJReZrA5LmdRQTrvlpaEUDKm6NlyG X-Received: by 2002:a17:907:2e01:b0:77e:d84d:9e07 with SMTP id ig1-20020a1709072e0100b0077ed84d9e07mr6099288ejc.674.1664530905876; Fri, 30 Sep 2022 02:41:45 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x3-20020aa7d383000000b00458170383f0si1499366edq.269.2022.09.30.02.41.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 02:41:45 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=LJGtHb0F; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9E4D385C416 for ; Fri, 30 Sep 2022 09:41:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9E4D385C416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664530904; bh=H17wHmjwDAEMf/LDrzULoccWoRSmpjt5+lcLsrD1CUA=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LJGtHb0FkQj9Mkewxu5gJJWemHQvu+AabpLHhgOKTVnxFHaJ+91MxsUE8HAr/yjfe MxD/lB+pdt1Q28mtuACpjZA33cCaqJmTBwRHPJ/KVemPrGMcA4pQaVv0yJlCIO4HJy qi04bkChEbum4z+ONNDNz1GXgYR61u9QLqayQNDQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by sourceware.org (Postfix) with ESMTPS id 18B6A3857371 for ; Fri, 30 Sep 2022 09:41:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18B6A3857371 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWvQAvDyzf3crT3VBCOXikFyQ/aKtmD59Zxh45hihZ3xD1UGb7xVC5nQuA/4i5KkW4StQd9o0UqLAm8PueYQu2BxIZ6eT4nOkqpmPd9uJZt8wgalTpC1Fv0FcsLdyFSYtKTmOb9XLJGOEWOc+ya0GK7xc0I7mSciv4k/fi5CntPesrUq/BACTN7EMVdpghZF7CXN7iktzpynYIax943d5v5RGunNkLpqSdyBL47/wMWEpLHSoBSk3na3lUebpI8/WUN2gbpektcfHwrGgzL0+7rCShaMJfAp/5cfIzaQm4gc3W4L0JPaP0pIkujrWeZDWr3fCM21VkqglVLGJJZ6bQ== 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=H17wHmjwDAEMf/LDrzULoccWoRSmpjt5+lcLsrD1CUA=; b=B4h3l1bxFll6RDiyB8pV4YhxqIvFiPYfs2UO5XpHQm3gn0FAFT9xfdxRhwP1CSPqQSBMxwdGexscSt7WwL6//g13ir5QUyXN9HivsAUAEqYaLRZqx3PrBj/Uabn9GRkfy4SqssMH3kSMhBPqEefdH2xszqN9EKBMWoo3zOILn3QRhXFqJJFqJJh2KxkW5y87qPyFxecUMapY0vFZRFLebnjjEM+F3FSVcJgUAPF/GXur+OWWWe5mSfimpnxqOA4+nT3A9DTPrJBBxmFPMxiqBPgBjxRZRh8Fw35u0IiCFYjfMpyCZd+3PuekDLVdnbw1B4rSj22piydjvN9mABzeOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM8PR04MB7795.eurprd04.prod.outlook.com (2603:10a6:20b:24f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 09:41:31 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2459:15ae:e6cb:218a]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2459:15ae:e6cb:218a%7]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 09:41:30 +0000 Message-ID: <5874dd79-0cf5-d65c-7ea2-13adfc799c0f@suse.com> Date: Fri, 30 Sep 2022 11:41:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: [PATCH] RISC-V: fix build after "Add support for arbitrary immediate encoding formats" To: Binutils References: <7cb92a0b-d1ef-e3db-4773-0b6cd5183272@suse.com> Content-Language: en-US In-Reply-To: <7cb92a0b-d1ef-e3db-4773-0b6cd5183272@suse.com> X-ClientProxiedBy: FR0P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::9) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7795:EE_ X-MS-Office365-Filtering-Correlation-Id: b62515e1-bc49-47d6-75cb-08daa2c7f42c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7tJhETuof4taJCywRTErigiGlfIg7+w7ssc6M1WCKNtZJzfBc5aFZBYLH8qC8vVdtTrqnxsb81UX3PbRrjRc+SiWvng9wz0dZ6lzciNIftXMX2gOV+0PWojoD6TM5lJl5JZXaEpyq+d5dDZcDGFOuZlOV1+89v+yn7kbPeXm4pnRD5vUzolmKEDEMHZW5Blu+ZYmzBjasn6+P/nfg8GU3W30REPwtcQNBpP/jW5LbUVGhvmGa9ZKUUIWT+nOWwOJdqyuwAy/zvSfWHhuuCer6qXCSMi8mZiGJdPOFOOde2m49fG83mzUc1p75LoGJAi+N1X9ae10yO7Fu1yFWFEHFyR4wjxO7gM4zFMdRU3Z1y+MRatt/JMNSaczquwfcNmZm7SqDVjog0eHdnuaFx87RePsQZ3mXTffCsHy7MTnGx/wgA0XsUqPQhOtgDyipGoxHbIvCAIRCN0Lz5reQjxq7z+FSEa633VfOqgrc0uB6JTwnN1x+P38nq/GDKbidcYMv43iOQNIkF+przEPtr8cfvZRzCZVodTmM4iK6P2kfNUyiQJo1npcZ/tCbL36COvAiP4R+mhKqeSAfWb3tpW6oEL1y9qMzmhmkxxt2z3LXvbGSmfQSluyoO0D7mmjnpUVBbyycxFl6lchTJEo9vWh6tTwYNG2CtHTzpkJarGQZlN0W56+z+KlKd74Jf8nXfOt1Pm/2Z81eF47nA2FYvSDyNWT+jErhvUm34RjLMdE547iIReBXKceeXK+hR2CGCCePYMwaPYyGy6JbyU2rmJ7oWkD5LrS2F0rdwwzxrO6cFS8aPQ3/XoApH4NR1aArV4RFvOCn17by1ioJ6TEluSUFA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(366004)(396003)(39860400002)(346002)(376002)(451199015)(83380400001)(2906002)(186003)(2616005)(86362001)(31696002)(36756003)(38100700002)(31686004)(66556008)(66476007)(66946007)(6486002)(316002)(54906003)(478600001)(6506007)(41300700001)(6916009)(26005)(6512007)(8936002)(5660300002)(4326008)(8676002)(14773001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?mIsz4u8dxn+JHZPGkhs40lenC8pK?= =?utf-8?q?WyWVoBl9S94wfIUyCa53GffxneyJempidUfRNkFIub8okLPt+KshYqCQLoBCFp4kC?= =?utf-8?q?nCcW+7jA3UcjGuyY4XTr1BWDOfsw6TcYLvIYKrktKw+iCErCBKNpNa9zIUvG28AKM?= =?utf-8?q?kEBAIva3L8OkocPiLeiL5Y3kH5HrTAE2J03EqRyRHX0fGx5HaNMNiu+P0zcsUmyI9?= =?utf-8?q?hfs09eA54CdWMZFIOqIHPmhor9Z5sgbgx6ye9CnrsuwjZpYK6gDMMZjlNxviplnjM?= =?utf-8?q?Ga7nLA0r9Is6Kk5XDG2atN+603SKz2C9qgM2f8xdzee7LXXVn6yZIngKnYVlXHpmB?= =?utf-8?q?1drWaM4llhDhJC4T4FBw1NRgNASItud3gss3YeDrXrnKC+vp0VUKqjL+uLs3GzjEd?= =?utf-8?q?EvI+cNc1tw1XLKdgzivQblHsDByCcWHr8UJp4SWXRN22hRYjJs6y2wU2BZU0TZlHC?= =?utf-8?q?dD6OAUxbLADsOEdc1qVGCQGCZUkrpB3ok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nCnMeF0mBkzKzLmJQv0jv9L5?= =?utf-8?q?ZeXs+CjkuKnQAo634IbisP1hqVCGgtv1IHrCmmoJ3pxdM/sfTnXREWC5lrCkE/g2b?= =?utf-8?q?8OuIlkiD+f7t8Hli6AEVeE9a6gTt60lQwXd7s27aFtNv90X1rIZHVrBx7YA/MkZ3J?= =?utf-8?q?X9LFIPC4k0w3?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b62515e1-bc49-47d6-75cb-08daa2c7f42c X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 09:41:30.8217 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jUjOsZPA2b90H/jWXy4sYl5an8uWABb63zQ27/gl8yBWIc0FnLdbY5MsoFGDJWT4BuljphGPzRBBABPPrG1lTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7795 X-Spam-Status: No, score=-3030.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50Ig==?= X-GMAIL-THRID: =?utf-8?q?1745387159053354871?= X-GMAIL-MSGID: =?utf-8?q?1745387159053354871?= Pre- and post-increment/decrement are side effects, the behavior of which is undefined when combined with passing an address of the accessed variable in the same function invocation. There's no need for the increments here - simply adding 1 achieves the intended effect without triggering compiler diagnostics (which are fatal with -Werror). --- Committing as obvious. --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -1287,10 +1287,10 @@ validate_riscv_insn (const struct riscv_ case 'u': /* 'XuN@S' ... N-bit unsigned immediate at bit S. */ goto use_imm; use_imm: - n = strtol (++oparg, (char **)&oparg, 10); + n = strtol (oparg + 1, (char **)&oparg, 10); if (*oparg != '@') goto unknown_validate_operand; - s = strtol (++oparg, (char **)&oparg, 10); + s = strtol (oparg + 1, (char **)&oparg, 10); oparg--; USE_IMM (n, s); @@ -3327,10 +3327,10 @@ riscv_ip (char *str, struct riscv_cl_ins sign = false; goto parse_imm; parse_imm: - n = strtol (++oparg, (char **)&oparg, 10); + n = strtol (oparg + 1, (char **)&oparg, 10); if (*oparg != '@') goto unknown_riscv_ip_operand; - s = strtol (++oparg, (char **)&oparg, 10); + s = strtol (oparg + 1, (char **)&oparg, 10); oparg--; my_getExpression (imm_expr, asarg); --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -586,10 +586,10 @@ print_insn_args (const char *oparg, insn sign = false; goto print_imm; print_imm: - n = strtol (++oparg, (char **)&oparg, 10); + n = strtol (oparg + 1, (char **)&oparg, 10); if (*oparg != '@') goto undefined_modifier; - s = strtol (++oparg, (char **)&oparg, 10); + s = strtol (oparg + 1, (char **)&oparg, 10); oparg--; if (!sign)