From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bbd2761f1bso7817525ad.2 for ; Thu, 27 Jul 2023 07:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690466966; x=1691071766; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=zwI1oj4tyDMNbQVfpzN1kf/xqtxNJxVg0Krmpn0PMSk=; b=HFDiqkvENmFktPCMxyKmf38WZUhVHOpS6qrMG/fohPc7Poo43EglyMbXmxndw2GWWe /WM5hexDfLx+Qu1KZsYzpXtkX8BDaZgRSuonO73Vn/GZ0Fju/sVzHIirXCo3uvEQsDuf nbkFCdpKeOIRpM09jusCoD8zpxBIpErHCx4L8eYIY01T9GevOU5NGNHsfIhaIUBLCnRr Ra9wjPHFJ5M1irhTh2THpNfmU+Y2hj5AER/nr0QrRqRA5IMKD/9IeF8KuvbO7GzuHzjx Km/zvLYlV0B8t6eoCVgD061+ZoG1kFyv5st5YMC4W8Pkm9N7DSoKyo/G91FpAMjrpz8h thxg== 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-Google-Smtp-Source: APBJJlGgnNNen7QjGRCmCvAWN+qzDa0tKI8f4kxy5OJD1/POI4PUrTB3qdWI3Qor7A3g/R7Y/HUbWA== 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 From: Alan Modra To: binutils@sourceware.org Subject: sh: uninitialised sh_operand_info.type in get_specific Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 List-Id: 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" } -- Alan Modra Australia Development Lab, IBM