From patchwork Thu Jul 27 14:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 126984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1127210vqo; Thu, 27 Jul 2023 07:09:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7up8vK7zq1vJexseCoh5tgJ5tS+/GxaUVdkTZOAb2HInQRa3z2OcFtZXhUs4N+FZzVuZE X-Received: by 2002:a05:6402:12:b0:51d:9905:6f60 with SMTP id d18-20020a056402001200b0051d99056f60mr1729403edu.41.1690466984072; Thu, 27 Jul 2023 07:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690466984; cv=none; d=google.com; s=arc-20160816; b=XbIGFe8aNCypLj93Nnfh58n5MDvOskTvBxrs1rjmGgJS8AJyRExwKEHRap78kaWAWp hMFof1wjWOBmoli868r42W8Cplvv15GV2x23Tz6Nn1xKwAaEmvY/aC+dHGUBzuimQglD +VYNJMOGrMe3YBbwqxUT5Wy8g0wjdSu45X7/xF6vY/kzNhSGVZJzONfSMGOw3VldyseA J9CFbrHADFXDQs2OTuhuYjfsoLPmJbznC9KGQl9jn8RGYsvDBuASdt4f3dzCDXHFqy43 NYiIYlH6psTPG1BSTp5uwIqwVZFdAnKst/OcNM8t3wBTtKThJA0ng4PCowHoxBBThRzh xWmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=zwI1oj4tyDMNbQVfpzN1kf/xqtxNJxVg0Krmpn0PMSk=; fh=HNIqzTA9Dp00ovCAyCdXfuEvWDT00OlFxFRPLybXRis=; b=MD0Pjs5pSh1fT+TUAZ/t3/ymcdiXBvdpGu+wU5mVj0DQxb+WzVjHiWnN69SCxMkt1Z CAn7ws4cWdvNwEv9B1JBHDG5ArCHqvf6NHv9azj8E2Y/K8T1WW26gOMpTyS2haFGuWew gY+KpK0ga3A1notrUSUGh8cZEaXIWVwCN8oregSv6iwXS3TW1T9Qe9hH5ms47SgLNV0O jEVcTSPVMLJ9j1uKr39+hLwQ2QkTAhl6XAOArDkc6WN8VNn3OO1MPbfvhx3N24ojuxNU q0SR8oK5NNprX/zqg3J1F32kafub7IEOETlK2AiYS7JOzu5TfkbXCywCJsN9eHp0OuMx ZnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BgbEgsrU; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j9-20020aa7c409000000b005222af123b5si951008edq.680.2023.07.27.07.09.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 07:09:44 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BgbEgsrU; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 E5EB33856954 for ; Thu, 27 Jul 2023 14:09:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5EB33856954 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690466982; bh=zwI1oj4tyDMNbQVfpzN1kf/xqtxNJxVg0Krmpn0PMSk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=BgbEgsrUvGYOT1vUQ11h80Veor+3B3ANwiXSZuHdtgMwVBuxNyOmKvvYLR3zCnf1S K+P3ECpmZtjEGx04NfMfRwTuzA5Qj7FgUCzGQS3LMjzLtDIXQlbmR/8UT2LePVyC1b lUfEuTdn0/FVj3+moW6Z9GFEn5aSz5elraQI5YbQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 3372A385771F for ; Thu, 27 Jul 2023 14:09:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3372A385771F Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bbd2761f1bso7817525ad.2 for ; Thu, 27 Jul 2023 07:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690466966; x=1691071766; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zwI1oj4tyDMNbQVfpzN1kf/xqtxNJxVg0Krmpn0PMSk=; b=YxZzj6yh3JmH0rrU+HmTxoOiC1MkKgIg2OqMQluHtOrfzdYsb0cWzl/cVotwisrpCu OkBw3EkOEECmpMP0v09HtV/WQp6NlvyHXFFh57WMSm3tPLYxjPn1R4QgsVxqiLD4YwBm ErkYKnMnIQpmb7n8GGcBvgRk1TW01EFbFwXRPl/Tges+5pP0s6CqH/O+GXgFd13ersUB 8pjSrZ1glADNp2fllOqKJIKRlb1LbdAt5Ds2w6gLwQCKgGbEPZMLeQnunWgMOBFWYslE bQUjH7v+OAhm5tGGyeOXWbbsrrGjZfRdGQacFgGeZbwc7h7CoKoBrDjwTd3NKy2IUm0U TALw== X-Gm-Message-State: ABy/qLaKOi1q8JyZhCPBkjRghqT312v46wIQEsO/PeiirWVe13NS2R8l +r1AXryojOo15Y4+0eiA0cpRmpHt+LI= X-Received: by 2002:a17:902:ba8c:b0:1aa:d971:4623 with SMTP id k12-20020a170902ba8c00b001aad9714623mr4589559pls.38.1690466966485; Thu, 27 Jul 2023 07:09:26 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id s4-20020a170902b18400b001b8b4730355sm1658894plr.287.2023.07.27.07.09.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 07:09:25 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id F05511140145; Thu, 27 Jul 2023 23:39:22 +0930 (ACST) Date: Thu, 27 Jul 2023 23:39:22 +0930 To: binutils@sourceware.org Subject: sh: uninitialised sh_operand_info.type in get_specific Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: 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: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772583108317878284 X-GMAIL-MSGID: 1772583108317878284 Seen when running gas/testsuite/gas/sh/err-at.s * config/tc-sh.c (get_operands): Always init operand type. * testsuite/gas/sh/err-at.s: Expect unnecessary extra errors. diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index bc0380a4961..634d5dcde41 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -1222,6 +1222,10 @@ static char * get_operands (sh_opcode_info *info, char *args, sh_operand_info *operand) { char *ptr = args; + + operand[0].type = 0; + operand[1].type = 0; + operand[2].type = 0; if (info->arg[0]) { /* The pre-processor will eliminate whitespace in front of '@' @@ -1234,9 +1238,7 @@ get_operands (sh_opcode_info *info, char *args, sh_operand_info *operand) if (info->arg[1]) { if (*ptr == ',') - { - ptr++; - } + ptr++; get_operand (&ptr, operand + 1); /* ??? Hack: psha/pshl have a varying operand number depending on the type of the first operand. We handle this by having the @@ -1247,28 +1249,11 @@ get_operands (sh_opcode_info *info, char *args, sh_operand_info *operand) if (info->arg[2] && operand[0].type != A_IMM) { if (*ptr == ',') - { - ptr++; - } + ptr++; get_operand (&ptr, operand + 2); } - else - { - operand[2].type = 0; - } - } - else - { - operand[1].type = 0; - operand[2].type = 0; } } - else - { - operand[0].type = 0; - operand[1].type = 0; - operand[2].type = 0; - } return ptr; } diff --git a/gas/testsuite/gas/sh/err-at.s b/gas/testsuite/gas/sh/err-at.s index 648ee94e140..af5d081c0ee 100644 --- a/gas/testsuite/gas/sh/err-at.s +++ b/gas/testsuite/gas/sh/err-at.s @@ -4,7 +4,9 @@ start: mov.l r1,@r0 ! ok mov.l r1,@(r0) ! { dg-error "syntax error" } +! { dg-bogus "invalid operands for opcode" "" { xfail *-*-* } 6 } mov.l r1,@(r0,) ! { dg-error "syntax error" } +! { dg-bogus "invalid operands for opcode" "" { xfail *-*-* } 8 } mov.l r1,@(r0,r0) ! ok mov.l r1,@(r0,r1) ! ok mov.l r1,@(r1,r0) ! { dg-error "must be" }