From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10044 Path: news.gmane.org!not-for-mail From: Ed Schouten Newsgroups: gmane.linux.lib.musl.general Subject: a64l(): return value should be sign extended Date: Mon, 23 May 2016 20:01:24 +0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1464026505 22485 80.91.229.3 (23 May 2016 18:01:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 May 2016 18:01:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10057-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 23 20:01:44 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1b4uAi-0007mZ-HB for gllmg-musl@m.gmane.org; Mon, 23 May 2016 20:01:44 +0200 Original-Received: (qmail 7544 invoked by uid 550); 23 May 2016 18:01:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7460 invoked from network); 23 May 2016 18:01:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:date:message-id:subject:from:to; bh=zy54ySAAmkUQczt3+TDYUCpD/f4oF6Okviyyg0kFJQY=; b=fM8vlcHii+T7Ck+Gi1aePTzUn6wmdcgwzUFEmVhpnn5DSGvmU3LzLmeojgDR8X9B59 GpkEd9SRZJQo8c/69ir+lQVVZxzsj/WNWN4o+ov4KpF57UW8g0/KzFjHGV9skFfFzblH nTDFHS+CI8uNaJ+daE6t8GzoZNNYvLARCUeAunjGYYlBD82YCduxXEh6mRZkLBbLqjxX iyNTQ53RUQm52uLU15SzzaScF9rswNwRdkSLLHCXCQM0ZhTfemYIgiICeEcjyIFt0gTm lplAmpUYvuwmL5KfbzWUUKZ6IVXTFp70C77ZdHHB3Obp65pHCAbXbPhyOcIbBiQT2PHZ /P9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=zy54ySAAmkUQczt3+TDYUCpD/f4oF6Okviyyg0kFJQY=; b=K5hlQ/gkGHMjzg71xlOY0qzBFP86m2q0pACktYRwBitP6N4Npl/dG/61rLcd1k/Bpl E5IgKBTX9adcfR/QrKXwvT1HHsfcZZNGlKuI3QCP7amFTl1/GuUFr5+MPu6FwyM8pI9K 5koX+rAAlcSPzCoJDm5VsktceR2CgVwGKbOu4yi02/80SL3KnVPUn4uRSf7vQyE7A7Zi d0yvBC+NwAFM1jHzgutDifMrWgbS9TJbjGjpwQ0fIA3GEdy8ZNTJDPw9uZVPUIR9A4a+ xE56pBJjKp5n1EJ/Ma3s5frpGwFiLpf9rsJrchRbyjMIyjuBdpGzBEdynRBThBteSQMN GNcg== X-Gm-Message-State: ALyK8tJy7+lVKI6D0b5lMTyPnu3Dc2x5sIMp5Saegk0y97k6wrX3qRhU/pUoOdkchlzkcpQZ8RYQf64qSTax8g== X-Received: by 10.129.53.70 with SMTP id c67mr68782ywa.149.1464026484393; Mon, 23 May 2016 11:01:24 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:10044 Archived-At: Hi there, While reading some of musl's sources, I think I might have found a tiny bug, though I haven't tested the code myself. The 'x' variable in the a64l() function has type uint32_t, meaning that the function computes a value between [0,2^32). According to POSIX, the return value of this function should be sign extended -- not zero extended -- in case long is larger than 32 bits. This means that the return statement in this function should either cast x to an int32_t, or the declaration of x should be changed to an int32_t. Best regards, -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717