From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SUBJ_OBFU_PUNCT_FEW autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id 24108447 for ; Wed, 15 Jan 2020 13:51:06 +0000 (UTC) Received: (qmail 15918 invoked by uid 550); 15 Jan 2020 13:51:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15900 invoked from network); 15 Jan 2020 13:51:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579096253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bq54dDQNAOwR6MQga5HqKteacAPyvsWjbzqfcslDH/8=; b=WN48xie6F76ay256FH0tnS7ksaxVSJbJvuMnJaxE/4w65HvA9CqIBGdHNnyOQbmJxpNLlk t5nFIKT28qZ/z/8LfBGoaAvBUHBW5YxUpAMIZMIdG9qOyS4w468FkiN1ayL5VY9EwNVP6l h6PiQCrbrjWkEuU5qYDBOEJ45h+ZQyc= From: Florian Weimer To: =?utf-8?Q?Lu=C3=ADs?= Marques Cc: musl@lists.openwall.com References: <20200115132438.5809-1-luismarques@lowrisc.org> Date: Wed, 15 Jan 2020 14:50:47 +0100 In-Reply-To: <20200115132438.5809-1-luismarques@lowrisc.org> (=?utf-8?Q?=22Lu=C3=ADs?= Marques"'s message of "Wed, 15 Jan 2020 13:24:41 +0000") Message-ID: <87v9pczv48.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: KGwL5sYwNruys9eVsuNNog-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] [PATCH] Fix RISC-V a_cas inline asm operand sign extension * Lu=C3=ADs Marques: > This patch adds an explicit cast to the int arguments passed to the inlin= e asm > used in the RISC-V's implementation of `a_cas`, to ensure that they are p= roperly > sign extended to 64 bits. They aren't automatically sign extended by Clan= g, and > GCC technically also doesn't guarantee that they will be sign extended. > > --- > arch/riscv64/atomic_arch.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv64/atomic_arch.h b/arch/riscv64/atomic_arch.h > index 41ad4d04..0c382588 100644 > --- a/arch/riscv64/atomic_arch.h > +++ b/arch/riscv64/atomic_arch.h > @@ -15,7 +15,7 @@ static inline int a_cas(volatile int *p, int t, int s) > =09=09"=09bnez %1, 1b\n" > =09=09"1:" > =09=09: "=3D&r"(old), "=3D&r"(tmp) > -=09=09: "r"(p), "r"(t), "r"(s) > +=09=09: "r"(p), "r"((long)t), "r"((long)s) > =09=09: "memory"); > =09return old; > } Are casts in this place really casts, and not merely type assertions? I think you have to use a temporarily variable or maybe a redundant +, to change the syntax. Thanks, Florian