From: Alan Modra <amodra@gmail.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: binutils@sourceware.org, Andreas Krebbel <krebbel@linux.ibm.com>
Subject: Re: [PATCH v2] IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
Date: Thu, 12 May 2022 12:25:13 +0930 [thread overview]
Message-ID: <Ynx3EW/ls5GsMjoJ@squeak.grove.modra.org> (raw)
In-Reply-To: <20220504103648.1724970-1-iii@linux.ibm.com>
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
next prev parent reply other threads:[~2022-05-12 2:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 10:36 Ilya Leoshkevich
2022-05-09 5:44 ` Andreas Krebbel
2022-05-09 20:01 ` Andreas Krebbel
2022-05-12 2:55 ` Alan Modra [this message]
2022-05-12 12:33 ` Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ynx3EW/ls5GsMjoJ@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=iii@linux.ibm.com \
--cc=krebbel@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).