From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 62600385742D for ; Thu, 12 May 2022 12:33:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62600385742D Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24CBkh5Z015170 for ; Thu, 12 May 2022 12:33:25 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g11nf11g6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 12:33:24 +0000 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24CCHwkQ029303 for ; Thu, 12 May 2022 12:33:24 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g11nf11cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 12:33:24 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24CCJogm001091; Thu, 12 May 2022 12:33:11 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3fwgd8wgh3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 12:33:11 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24CCX7Ru44695844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 12:33:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3817E42042; Thu, 12 May 2022 12:33:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F22EF4203F; Thu, 12 May 2022 12:33:06 +0000 (GMT) Received: from [9.171.25.184] (unknown [9.171.25.184]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 12:33:06 +0000 (GMT) Message-ID: <931d9973c3ad6ce322a5cbe56ee0a1c3f9961a82.camel@linux.ibm.com> Subject: Re: [PATCH v2] IBM zSystems: Accept (. - 0x100000000) PCRel32 operands From: Ilya Leoshkevich To: Alan Modra Cc: binutils@sourceware.org, Andreas Krebbel Date: Thu, 12 May 2022 14:33:06 +0200 In-Reply-To: References: <20220504103648.1724970-1-iii@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: b6DR6skIhEv5xjhPADMeFE_8_rFhKcs3 X-Proofpoint-GUID: O5SAC-8LlLbuhALTv63UTOIHTqKwRJyS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_10,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=867 impostorscore=0 priorityscore=1501 adultscore=0 phishscore=0 clxscore=1015 mlxscore=0 spamscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120058 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, 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 12:33:26 -0000 On Thu, 2022-05-12 at 12:25 +0930, Alan Modra wrote: > 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\) > Sorry for the breakage and thanks for fixing it. Not sure how I missed it - I just tried rebuilding my local commit, and it's visible there as well.