From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85015 invoked by alias); 1 Apr 2016 18:43:09 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 85003 invoked by uid 89); 1 Apr 2016 18:43:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1844, obtained X-HELO: mail-yw0-f170.google.com Received: from mail-yw0-f170.google.com (HELO mail-yw0-f170.google.com) (209.85.161.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 01 Apr 2016 18:43:07 +0000 Received: by mail-yw0-f170.google.com with SMTP id g127so179128997ywf.2 for ; Fri, 01 Apr 2016 11:43:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=fWg0ij9Hnf5I0Os3JP09bqsEFLE+oqyILYZOiU7FuHM=; b=SVaEjp5uONtopKA9QSqI6GlbiHoKpD6Kah0Yl2kXQcGyn+EJ+IXEewH1t2si1Wlt4P mVzFkuG7oZiwPXDLzQHK8mCMtsnJI1RVwJRKoPxeg1USPXwdpbv2UwWP3cDHvHYjyIsJ r8kHv/smcp/y+4EN38fV74LEzid1rW9cePCJYuCPvRU5G/4BNfuUqQhTyNDnbgbXamIc DzUo5rdKOOEhLsg8FGupdq6D/Q57ZbzBNYf550WEKjAvomjTg0gRBIRN0Pek/lfPcv2s d5ivCk2Y42xmGP/kNsAf10qCTGUFUHZJo0gFLv1kI9OmQttCQIUy3d8tKRKrfmWgLuTq aNhw== X-Gm-Message-State: AD7BkJL0dpfKDt151lKC6tWUTXuCD2IwJpDRDm6Lg3oM3rPqSvlNnq0lFM5caVG4xebdxg== X-Received: by 10.31.149.78 with SMTP id x75mr2122774vkd.103.1459536185132; Fri, 01 Apr 2016 11:43:05 -0700 (PDT) Received: from [10.32.219.123] (node13.seg212.ucf.edu. [132.170.212.13]) by smtp.googlemail.com with ESMTPSA id w144sm2760720vkd.2.2016.04.01.11.43.04 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2016 11:43:04 -0700 (PDT) Subject: Re: [gas] Unsigned arithmetic and %hi() operator To: binutils@sourceware.org References: <56FEBE99.1050600@gmail.com> From: Orlando Arias Message-ID: <56FEC1F3.8080909@gmail.com> Date: Fri, 01 Apr 2016 18:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <56FEBE99.1050600@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="T0IA6eOxlPkFb3wMr8qOqNvgCe1slVxKR" X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00011.txt.bz2 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --T0IA6eOxlPkFb3wMr8qOqNvgCe1slVxKR Content-Type: multipart/mixed; boundary="m9P59EiRTAGauKb3ipttvdgDE2cju60gt" From: Orlando Arias To: binutils@sourceware.org Message-ID: <56FEC1F3.8080909@gmail.com> Subject: Re: [gas] Unsigned arithmetic and %hi() operator References: <56FEBE99.1050600@gmail.com> In-Reply-To: <56FEBE99.1050600@gmail.com> --m9P59EiRTAGauKb3ipttvdgDE2cju60gt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1838 Greetings, Small correction: > sethi %hi(0x40000000U + 0x40000000U), %fp # does not assemble > sethi %hi(0x40000000 + 0x40000000), %fp # assembles Both statements assemble in this case. Sorry for the confusion. The larger statements fail to assemble. Thank you. Cheers, Orlando. On 04/01/2016 02:31 PM, Orlando Arias wrote: > Greetings, >=20 > I have been dealing with this issue for a while now and I believe to > have narrowed down the cause to an issue with the %hi() operator. I am > working with the sparc-leon3-linux target in gas versions 2.26.20160125 > and 2.23. >=20 > In the following assembly statements, the numbers come from macro > expansions by the C preprocessor. These statements fail to assemble with > the error "Error: missing ')' >=20 > sethi %hi(((((0x40000000U + 0x40000000U) - 160)-(8192U-160))-32U)), %fp > or %g0, %lo(((((0x40000000U +0x40000000U) - 160)-(8192U-160))-32U)), %fp >=20 > However, the following assembles just fine: >=20 > sethi %hi(((((0x40000000 + 0x40000000) - 160)-(8192-160))-32)), %fp > or %g0, %lo(((((0x40000000 +0x40000000) - 160)-(8192-160))-32)), %fp >=20 > The statements are exactly the same, except that the numbers are now > treated as signed. >=20 > I have further simplified this to: >=20 > sethi %hi(0x40000000U + 0x40000000U), %fp # does not assemble > sethi %hi(0x40000000 + 0x40000000), %fp # assembles >=20 > The same error behaviour can be obtained with the 'set' pseudoinstruction. >=20 > I could leave the U out of the macro definitions, but then gcc complains > of overflows in the macros (which is not a show stopper, but it is ugly, > as these macros get used repeatedly throughout the codebase). >=20 > Have I overlooked something in the documentation/bugtracker or is this a > parsing bug in gas? >=20 > Thank you for your time. >=20 > Cheers, > Orlando. >=20 --m9P59EiRTAGauKb3ipttvdgDE2cju60gt-- --T0IA6eOxlPkFb3wMr8qOqNvgCe1slVxKR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 181 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlb+wfMACgkQUxW/UBZ+LqErMACfQcWulR2PUY0fCm6lOpWxeZzc r0QAoKF7ou/EIRUtJ7DnVJjCGjPQpqTc =SuJP -----END PGP SIGNATURE----- --T0IA6eOxlPkFb3wMr8qOqNvgCe1slVxKR--