From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id 1650D3858C2D for ; Thu, 12 May 2022 02:55:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1650D3858C2D Received: by mail-pj1-x102a.google.com with SMTP id o69so3927540pjo.3 for ; Wed, 11 May 2022 19:55:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YBOSAUMs9yzlzcxNFzKxJTin5iMC1UmPUXcbtZMpu9U=; b=4k1rJAGq+BHZwflCZczPtYrYuJgAjgsXw/cks/OD52ENEGmDj6DH3X6I6SrlVXJijO qsp0YvjZ7qQ3h6Pz/jyw3KeA8UIVywyEpolmBO3O2U74gtgk0Nfj1QPXpWCcP3HXapoP xXA2j2W88jmGqYmV/88Z3OxW8vLp1hpi/Dlcmm0J20yqrZSO5iP0jq970dLk1KaxGmQG JkvcxeO5IhA8K/phqU7fXY4kxnmlWskf0vpFaxUVM8IFCeKbwyqgOL+3ubgpdRI5xUsm xQVNF3RuT7ZYO53QLAtydEBQ/2bDlfNtC1j7ibHz8NH7hPzzUSzojdUo7oyVRIVH4TUa bvsA== X-Gm-Message-State: AOAM531mCCc+z3JCvFH9hdfF4eKYbsu4qTBN3NTRsBk4LrjfR0TKvGtX 8jjx88ZfNBcjWppO3dx9XlAoD3JbT9M= X-Google-Smtp-Source: ABdhPJz+rwWsDggyoY9yiiL2Mfbq71P3RG0Ls4b14apfdHoZoiB8Uhr14ildADEBR8eIhVevWDrI0A== X-Received: by 2002:a17:903:22c1:b0:15e:c3b2:d632 with SMTP id y1-20020a17090322c100b0015ec3b2d632mr28957920plg.0.1652324117138; Wed, 11 May 2022 19:55:17 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:4691:5605:9086:23e7]) by smtp.gmail.com with ESMTPSA id x10-20020a170902a38a00b0015e8d4eb291sm2494510pla.219.2022.05.11.19.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 19:55:16 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id A855B1142F46; Thu, 12 May 2022 12:25:13 +0930 (ACST) Date: Thu, 12 May 2022 12:25:13 +0930 From: Alan Modra To: Ilya Leoshkevich Cc: binutils@sourceware.org, Andreas Krebbel Subject: Re: [PATCH v2] IBM zSystems: Accept (. - 0x100000000) PCRel32 operands Message-ID: References: <20220504103648.1724970-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220504103648.1724970-1-iii@linux.ibm.com> X-Spam-Status: No, score=-3035.6 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-List-Received-Date: Thu, 12 May 2022 02:55:19 -0000 The new test failed on s390-linux due to bfd_sprintf_vma trimming output to 32 bits for 32-bit targets. The test was faulty anyway, expecting zero as the min end of the range is plainly wrong, but that's what you get if you cast min to int. I'm applying the following to fix this. You could also use as_bad_value_out_of_range here, and you'll get hex values for the test. The code would become if (val < min || val > max) { if (operand->flags & S390_OPERAND_PCREL) { val <<= 1; min <<= 1; max <<= 1; } as_bad_value_out_of_range (_("operand"), val, min, max, file, line); return; } * config/tc-s390.c (s390_insert_operand): Print range error using PRId64. * testsuite/gas/s390/zarch-z900-err.l: Correct expected output. diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 4fd4f1f0693..fb452f8a986 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -617,8 +617,8 @@ s390_insert_operand (unsigned char *insn, if (val < min || val > max) { const char *err = - _("operand out of range (%s not between %ld and %ld)"); - char buf[100]; + _("operand out of range (%" PRId64 " not between %" PRId64 + " and %" PRId64 ")"); if (operand->flags & S390_OPERAND_PCREL) { @@ -626,11 +626,11 @@ s390_insert_operand (unsigned char *insn, min <<= 1; max <<= 1; } - bfd_sprintf_vma (stdoutput, buf, val); if (file == (char *) NULL) - as_bad (err, buf, (int) min, (int) max); + as_bad (err, (int64_t) val, (int64_t) min, (int64_t) max); else - as_bad_where (file, line, err, buf, (int) min, (int) max); + as_bad_where (file, line, + err, (int64_t) val, (int64_t) min, (int64_t) max); return; } /* val is ok, now restrict it to operand->bits bits. */ diff --git a/gas/testsuite/gas/s390/zarch-z900-err.l b/gas/testsuite/gas/s390/zarch-z900-err.l index 72994192095..cf8e9c2cefc 100644 --- a/gas/testsuite/gas/s390/zarch-z900-err.l +++ b/gas/testsuite/gas/s390/zarch-z900-err.l @@ -1,3 +1,3 @@ .*: Assembler messages: -.*:3: Error: operand out of range \(fffffffefffffffe not between 0 and 4294967294\) -.*:4: Error: operand out of range \(0000000100000000 not between 0 and 4294967294\) +.*:3: Error: operand out of range \(-4294967298 not between -4294967296 and 4294967294\) +.*:4: Error: operand out of range \(4294967296 not between -4294967296 and 4294967294\) -- Alan Modra Australia Development Lab, IBM